Piwik\SettingsServer::setMaxExecutionTime PHP Method

setMaxExecutionTime() public static method

Set maximum script execution time.
public static setMaxExecutionTime ( integer $executionTime )
$executionTime integer max execution time in seconds (0 = no limit)
    public static function setMaxExecutionTime($executionTime)
    {
        // in the event one or the other is disabled...
        @ini_set('max_execution_time', $executionTime);
        @set_time_limit($executionTime);
    }

Usage Example

Beispiel #1
0
 /**
  * Update Piwik codebase by downloading and installing the latest version.
  *
  * @param bool $https Whether to use HTTPS if supported of not. If false, will use HTTP.
  * @return string[] Return an array of messages for the user.
  * @throws ArchiveDownloadException
  * @throws UpdaterException
  * @throws Exception
  */
 public function updatePiwik($https = true)
 {
     if (!$this->isNewVersionAvailable()) {
         throw new Exception($this->translator->translate('CoreUpdater_ExceptionAlreadyLatestVersion', Version::VERSION));
     }
     SettingsServer::setMaxExecutionTime(0);
     $newVersion = $this->getLatestVersion();
     $url = $this->getArchiveUrl($newVersion, $https);
     $messages = array();
     try {
         $archiveFile = $this->downloadArchive($newVersion, $url);
         $messages[] = $this->translator->translate('CoreUpdater_DownloadingUpdateFromX', $url);
         $extractedArchiveDirectory = $this->decompressArchive($archiveFile);
         $messages[] = $this->translator->translate('CoreUpdater_UnpackingTheUpdate');
         $this->verifyDecompressedArchive($extractedArchiveDirectory);
         $messages[] = $this->translator->translate('CoreUpdater_VerifyingUnpackedFiles');
         $disabledPluginNames = $this->disableIncompatiblePlugins($newVersion);
         if (!empty($disabledPluginNames)) {
             $messages[] = $this->translator->translate('CoreUpdater_DisablingIncompatiblePlugins', implode(', ', $disabledPluginNames));
         }
         $this->installNewFiles($extractedArchiveDirectory);
         $messages[] = $this->translator->translate('CoreUpdater_InstallingTheLatestVersion');
     } catch (ArchiveDownloadException $e) {
         throw $e;
     } catch (Exception $e) {
         throw new UpdaterException($e, $messages);
     }
     return $messages;
 }
All Usage Examples Of Piwik\SettingsServer::setMaxExecutionTime