Gets the local ini file update timestamp

@throws Exception
@return int the local modification timestamp
163350
protected function _getLocalMTime()
    {
        if (!is_readable($this->localFile) || !is_file($this->localFile)) {
            throw new Exception("Local file is not readable");
        }

        return filemtime($this->localFile);
    }
1360088
public function actionGetLocalFileByUrl() {
		$url = $this->request->url;
		if (!$url) {
			throw new \Exception('Need full url', Consts::ERROR_CODE_BAD_REQUEST);
		}

		$parts = parse_url($url);

		if (empty($parts['path'])) {
			throw new \Exception('Empty url', Consts::ERROR_CODE_BAD_REQUEST);
		}

		$found = false;
		$path = '';
		$root = '';

		$key = 0;

		foreach ($this->config->sources as $key => $source) {
			if ($this->request->source && $this->request->source !== 'default' && $key !== $this->request->source && $this->request->path !== './') {
				continue;
			}

			$base = parse_url($source->baseurl);

			$path = preg_replace('#^(/)?' . $base['path'] . '#', '', $parts['path']);


			$root = $source->getPath();

			if (file_exists($root . $path) && is_file($root . $path)) {
				$file = new File($root . $path);
				if ($file->isGoodFile($source)) {
					$found = true;
					break;
				}
			}
		}

		if (!$found) {
			throw new \Exception('File does not exist or is above the root of the connector', Consts::ERROR_CODE_FAILED);
		}

		return [
			'path' => str_replace($root, '', dirname($root . $path) . Consts::DS),
			'name' => basename($path),
			'source' => $key
		];
	}
1059327
public function getTimestamp(): int
    {
        $supportedClasses = implode(
            ', ',
            [
                '\MongoTimestamp',
                '\MongoDate',
                '\MongoDB\BSON\Timestamp',
                '\MongoDB\BSON\UTCDateTime',
                '\DateTimeInterface',
            ]
        );

        if (!$this->t || !is_object($this->t)) {
            throw new \DomainException(
                'The timestamp to normalise must be one of ' . $supportedClasses . ' but it is not an object'
            );
        }

        switch (get_class($this->t)) {
            case 'MongoTimestamp':
                return (int) $this->t->__toString();

            case 'MongoDate':
                return $this->t->sec;

            case 'MongoDB\BSON\Timestamp':
                return $this->t->getTimestamp();

            case 'MongoDB\BSON\UTCDateTime':
                return (int) $this->t->toDateTime()->format('U');
        }

        if ($this->t instanceof \DateTimeInterface) {
            return $this->t->getTimestamp();
        }

        throw new \DomainException(
            'The normalised timestamp must be one of ' . $supportedClasses
        );
    }
1023559
public function getLastModified()
	{
		if (is_null($this->lastModified)) {
			$this->lastModified = new \DateTime('@' . filemtime($this->path));
		}
		return $this->lastModified;
	}
357824
public function commit()
    {
        try {
            $toUpdate = array_merge($this->getFieldsToUpdate(), $this->getFieldsToDelete());

            if (! empty($toUpdate)) {
                $idField  = $this->_item->getIdField();

                $query = "
                    UPDATE
                        `" . $this->getDbPrefix() . $this->_item->getDbContainer() . "`
                    SET
                        " . $this->_getPreparedFields($toUpdate) . "
                    WHERE
                        `$idField` = ?";

                if (! array_key_exists($idField, $toUpdate)) {
                    $toUpdate[$idField] = $this->_item->getId()->getOrig();
                }

                $prepared = Agl::app()->getDb()->getConnection()->prepare($query);

                if (! $prepared->execute(array_values($toUpdate))) {
                    $error = $prepared->errorInfo();
                    throw new Exception("The update query failed (table '" . $this->getDbPrefix() . $this->_item->getDbContainer() . "') with message '" . $error[2] . "'");
                }

                if (Agl::app()->isDebugMode()) {
                    Agl::app()->getDb()->incrementCounter();
                }

                return $prepared->rowCount();
            }
        } catch (Exception $e) {
            throw new Exception($e);
        }

        return true;
    }
510324
private function getNextInteration()
    {
        // Get the next interator.
        $migrations = new Filesystem(new Adapter(base_path('database/migrations')));

        try {
            $files = $migrations->listContents();
        } catch (\Exception $exception) {
            $this->error($exception->getMessage());

            exit(1);
        }

        $files_filtered = array_filter($files, function ($value) {
            return stripos($value['filename'], date('Y_m_d')) !== false;
        });

        if (count($files_filtered) == 0) {
            return 1;
        }

        $files_filtered = array_column($files_filtered, 'path');

        sort($files_filtered);
        $latest_file = array_pop($files_filtered);
        $latest_details = explode('_', $latest_file);

        return (int) $latest_details[3] + 1;
    }
837359
protected function fetchNextUpdateTime()
    {
        // Function is called inside a transaction or from admin backend which uses master connection only.
        // Transaction picks master automatically (see ESDEV-3804 and ESDEV-3822).
        $database = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();

        // fetching next update time
        $sQ = $this->getQueryToFetchNextUpdateTime();

        $iTimeToUpdate = $database->getOne(sprintf($sQ, "`oxarticles`"));

        return $iTimeToUpdate;
    }
941040
private function getCronTimestamp()
    {
        /* @var $version string e.g. "2.1.7" */
        $version = $this->productMetadata->getVersion();
        if (version_compare($version, '2.2.0') >= 0) {
            return $this->dateTime->gmtTimestamp();
        }
        return $this->timezone->scopeTimeStamp();
    }
240043
protected function updateFile($filename)
    {
        $current = Context::getParam('current-version');
        $next = Context::getParam('new-version');

        $content = file_get_contents($filename);
        if (false === strpos($content, $current)) {
            throw new Exception('The version class ' . $filename . " does not contain the current version $current");
        }
        if (isset($this->options['pattern'])) {
            $current = str_replace('%version%', $current, $this->options['pattern']);
            $next = str_replace('%version%', $next, $this->options['pattern']);
        }
        $content = str_replace($current, $next, $content);
        if (false === strpos($content, $next)) {
            throw new Exception('The version class ' . $filename . " could not be updated with version $next");
        }
        file_put_contents($filename, $content);
    }
654808
public function update()
    {
        $data = $this->client->get('http://dev.maxmind.com/static/csv/codes/country_continent.csv');

        // Verify server response
        if ($this->client->getErrors() !== null) {
            throw new Exception($this->client->getErrors());
        }

        $lines = explode("\n", $data[0]);

        array_shift($lines);

        $output = [];

        foreach ($lines as $line) {
            $arr = str_getcsv($line);

            if (count($arr) < 2) {
                continue;
            }

            $output[$arr[0]] = $arr[1];
        }

        // Get path
        $path = $this->config('continent_path');

        file_put_contents($path, json_encode($output));

        return "Continent file ({$path}) updated.";
    }
167222
public function update()
    {
        try {
            Option::set(self::LAST_RUN_TIME_OPTION_NAME, Date::factory('today')->getTimestamp());

            $locUrl = Option::get(self::LOC_URL_OPTION_NAME);
            if (!empty($locUrl)) {
                $this->downloadFile('loc', $locUrl);
            }

            $ispUrl = Option::get(self::ISP_URL_OPTION_NAME);
            if (!empty($ispUrl)) {
                $this->downloadFile('isp', $ispUrl);
            }

            $orgUrl = Option::get(self::ORG_URL_OPTION_NAME);
            if (!empty($orgUrl)) {
                $this->downloadFile('org', $orgUrl);
            }
        } catch (Exception $ex) {
            // message will already be prefixed w/ 'GeoIPAutoUpdater: '
            StaticContainer::get(LoggerInterface::class)->error('Auto-update failed: {exception}', [
                'exception' => $ex,
                'ignoreInScreenWriter' => true,
            ]);
            $this->performRedundantDbChecks();
            throw $ex;
        }

        $this->performRedundantDbChecks();
    }
1254428
public function getGitVersion()
    {
        try {
            return $this->getGitTag();
        } catch (RuntimeException $exception) {
            try {
                return $this->getGitHash(true);
            } catch (RuntimeException $exception) {
                throw new RuntimeException(
                    sprintf(
                        'The tag or commit hash could not be retrieved from "%s": %s',
                        dirname($this->file),
                        $exception->getMessage()
                    ),
                    0,
                    $exception
                );
            }
        }
    }
581993
public function getModificationTime() {

		if(false !== $this -> file -> getExists()) {

			$this -> refresh();
			
			return $this -> file -> getModificationTime();
		}
	}
71200
public function lastModified()
	{
		$source = $this->targetPath();

		if ($this->declaration || !is_file($source))
		{
			return 0;
		}

		return filemtime($source);
	}
65290
public function getLastModified()
	{
		$mtime = 0;
		
		foreach($this->initializers as $initializer)
		{
			$mtime = max($mtime, filemtime((new \ReflectionClass(get_class($initializer)))->getFileName()));
		}
		
		return $mtime;
	}
979351
public function filemtime()
	{
		if ($this->use_include_path) {
			return filemtime(stream_resolve_include_path($this->_fhandle));
		} else {
			return filemtime($this->_fhandle);
		}
	}
425841
protected function _getRemoteMTime()
    {
        $remote_datetime = $this->_getRemoteData($this->remoteVerUrl);
        $remote_tmstp = strtotime($remote_datetime);

        if (!$remote_tmstp) {
            throw new Exception("Bad datetime format from {$this->remoteVerUrl}");
        }

        return $remote_tmstp;
    }