当前位置: 首页>>代码示例>>PHP>>正文


PHP increase_time_limit_to函数代码示例

本文整理汇总了PHP中increase_time_limit_to函数的典型用法代码示例。如果您正苦于以下问题:PHP increase_time_limit_to函数的具体用法?PHP increase_time_limit_to怎么用?PHP increase_time_limit_to使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了increase_time_limit_to函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 public function run($request)
 {
     $strCSVPath = CONTINENTAL_CONTENT_PATH . '/code/ThirdParty/IP2LOCATION-DB.CSV';
     if (!file_exists($strCSVPath)) {
         echo "<p>I cant find the IP2LOCATION-DB.CSV file to import any data.<br>\n\t\t\t\tPlease download DB3.LITE database from <a href='http://lite.ip2location.com/'>http://lite.ip2location.com/</a>.<br>\n\t\t\t\tNOTE: It's adviced to edit the DB to only include the countries you want to handle, it contains 2 million records!!!<br>\n\t\t\t\tOr make a CSV contain these columns<br>\n\t\t\t\t`IPFrom`,`IPTo`,`Country`,`CountryName`,`Region`,`City`\n\t\t\t\t</p>";
     } else {
         if (!isset($_REQUEST['confirm'])) {
             $strLink = Director::baseURL() . 'dev/tasks/ImportIPToLocationTask?confirm=1';
             echo "<p>CAUTION!!!<br>\n\t\t\t\t\tPlease confirm your action<br>\n\t\t\t\t\t<a href='{$strLink}'>I confirm the action</a><br>\n\t\t\t\t\t<a href='{$strLink}&emptydb=1'>I confirm the action, please empty the DB before you import</a>\n\t\t\t\t\t</p>";
         } else {
             increase_time_limit_to();
             if (isset($_REQUEST['emptydb'])) {
                 DB::query('TRUNCATE `IpToLocation`;');
             }
             $arrFields = array_keys(Config::inst()->get('IpToLocation', 'db'));
             $handle = fopen($strCSVPath, "r");
             if ($handle) {
                 while (($line = fgets($handle)) !== false) {
                     $line = str_replace('","', '___', $line);
                     $line = str_replace('"', '', $line);
                     $arrParts = Convert::raw2sql(explode("___", $line));
                     unset($arrParts[3]);
                     DB::query('INSERT INTO `IpToLocation` (`' . implode('`,`', $arrFields) . '`) VALUES (\'' . implode('\',\'', $arrParts) . '\')');
                 }
                 fclose($handle);
             } else {
                 echo 'Error opening file';
             }
         }
     }
 }
开发者ID:helpfulrobot,项目名称:silverstripers-continental-content,代码行数:31,代码来源:ImportIPToLocationTask.php

示例2: run

 function run($request)
 {
     increase_time_limit_to(3600);
     $gitUser = $this->Config()->get("git_user_name");
     $packagistUser = $this->Config()->get("git_user_name");
     if ($gitUser && $packagistUser) {
         //all is good ...
     } else {
         user_error("make sure to set your git and packagist usernames via the standard config system");
     }
     $count = 0;
     $this->getAllRepos();
     echo "<h1>Testing " . count(self::$modules) . " modules (git user: {$gitUser} and packagist user: {$packagistUser}) ...</h1>";
     $methodsToCheck = $this->Config()->get("methods_to_check");
     foreach (self::$modules as $module) {
         $count++;
         $failures = 0;
         echo "<h3><a href=\"https://github.com/" . $gitUser . "/silverstripe-" . $module . "\"></a>{$count}. checking {$module}</h3>";
         foreach ($methodsToCheck as $method) {
             if (!$this->{$method}($module)) {
                 $failures++;
                 DB::alteration_message("bad response for {$method}", "deleted");
             }
         }
         if ($failures == 0) {
             DB::alteration_message("OK", "created");
         }
         ob_flush();
         flush();
     }
     echo "----------------------------- THE END --------------------------";
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-modulechecks,代码行数:32,代码来源:ModuleChecks.php

示例3: run

 /**
  * This is the main method to build the master string tables with the original strings.
  * It will search for existent modules that use the i18n feature, parse the _t() calls
  * and write the resultant files in the lang folder of each module.
  * 
  * @uses DataObject->collectI18nStatics()
  */
 public function run($request)
 {
     increase_time_limit_to();
     $c = new i18nTextCollector();
     $restrictModules = $request->getVar('module') ? explode(',', $request->getVar('module')) : null;
     return $c->run($restrictModules);
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:14,代码来源:i18nTextCollectorTask.php

示例4: run

 /**
  * 
  * @param SS_HTTPRequest $request
  */
 public function run($request)
 {
     increase_time_limit_to();
     echo 'Pass ?refresh=1 to refresh your members<br/>';
     echo '<hr/>';
     $refresh = $request->getVar('refresh');
     if ($refresh) {
         DB::alteration_message("Resetting all members location");
         DB::query('UPDATE Member SET Latitude = 0, Longitude = 0');
     }
     $Members = Member::get()->filter(array('Latitude' => 0));
     foreach ($Members as $Member) {
         DB::alteration_message('Processing member #' . $Member->ID . ' - ' . $Member->getTitle());
         if (!$Member->Latitude) {
             if ($Member->canBeGeolocalized()) {
                 DB::alteration_message($Member->GeocodeText());
                 if (!$Member->CountryCode) {
                     DB::alteration_message("Warning ! This member has no country code", "error");
                 }
                 /* @var $res Geocoder\Model\Address */
                 $res = $Member->Geocode();
                 if ($res) {
                     DB::alteration_message('Geocode success on ' . $res->getLatitude() . ',' . $res->getLongitude() . ' : ' . $res->getStreetNumber() . ', ' . $res->getStreetName() . ' ' . $res->getPostalCode() . ' ' . $res->getLocality() . ' ' . $res->getCountry(), 'created');
                     $Member->write();
                 } else {
                     DB::alteration_message('Geocode error', 'error');
                 }
             } else {
                 DB::alteration_message('Cannot be geolocalized', 'error');
             }
         } else {
             DB::alteration_message('Already geolocalized', 'error');
         }
     }
 }
开发者ID:lekoala,项目名称:silverstripe-geotools,代码行数:39,代码来源:GeolocateAllMembersTask.php

示例5: __construct

 function __construct($filename = null)
 {
     // If we're working with image resampling, things could take a while.  Bump up the time-limit
     increase_time_limit_to(300);
     if ($filename) {
         // We use getimagesize instead of extension checking, because sometimes extensions are wrong.
         list($width, $height, $type, $attr) = getimagesize($filename);
         switch ($type) {
             case 1:
                 if (function_exists('imagecreatefromgif')) {
                     $this->setGD(imagecreatefromgif($filename));
                 }
                 break;
             case 2:
                 if (function_exists('imagecreatefromjpeg')) {
                     $this->setGD(imagecreatefromjpeg($filename));
                 }
                 break;
             case 3:
                 if (function_exists('imagecreatefrompng')) {
                     $this->setGD(imagecreatefrompng($filename));
                 }
                 break;
         }
     }
     $this->quality = self::$default_quality;
     parent::__construct();
 }
开发者ID:rixrix,项目名称:sapphire,代码行数:28,代码来源:GD.php

示例6: sendFile

 /**
  * Output file to the browser.
  * For performance reasons, we avoid SS_HTTPResponse and just output the contents instead.
  */
 public function sendFile($file)
 {
     $path = $file->getFullPath();
     if (SapphireTest::is_running_test()) {
         return file_get_contents($path);
     }
     header('Content-Description: File Transfer');
     // Quotes needed to retain spaces (http://kb.mozillazine.org/Filenames_with_spaces_are_truncated_upon_download)
     header('Content-Disposition: inline; filename="' . basename($path) . '"');
     header('Content-Length: ' . $file->getAbsoluteSize());
     header('Content-Type: ' . HTTP::get_mime_type($file->getRelativePath()));
     header('Content-Transfer-Encoding: binary');
     // Fixes IE6,7,8 file downloads over HTTPS bug (http://support.microsoft.com/kb/812935)
     header('Pragma: ');
     if ($this->config()->min_download_bandwidth) {
         // Allow the download to last long enough to allow full download with min_download_bandwidth connection.
         increase_time_limit_to((int) (filesize($path) / ($this->config()->min_download_bandwidth * 1024)));
     } else {
         // Remove the timelimit.
         increase_time_limit_to(0);
     }
     // Clear PHP buffer, otherwise the script will try to allocate memory for entire file.
     while (ob_get_level() > 0) {
         ob_end_flush();
     }
     // Prevent blocking of the session file by PHP. Without this the user can't visit another page of the same
     // website during download (see http://konrness.com/php5/how-to-prevent-blocking-php-requests/)
     session_write_close();
     readfile($path);
     die;
 }
开发者ID:helpfulrobot,项目名称:i-lateral-silverstripe-commerce-downloadableproduct,代码行数:35,代码来源:DownloadableFileController.php

示例7: __construct

 public function __construct($filename = null)
 {
     // If we're working with image resampling, things could take a while.  Bump up the time-limit
     increase_time_limit_to(300);
     if ($filename && is_readable($filename)) {
         // We use getimagesize instead of extension checking, because sometimes extensions are wrong.
         list($width, $height, $type, $attr) = getimagesize($filename);
         switch ($type) {
             case 1:
                 if (function_exists('imagecreatefromgif')) {
                     $this->setImageResource(imagecreatefromgif($filename));
                 }
                 break;
             case 2:
                 if (function_exists('imagecreatefromjpeg')) {
                     $this->setImageResource(imagecreatefromjpeg($filename));
                 }
                 break;
             case 3:
                 if (function_exists('imagecreatefrompng')) {
                     $img = imagecreatefrompng($filename);
                     imagesavealpha($img, true);
                     // save alphablending setting (important)
                     $this->setImageResource($img);
                 }
                 break;
         }
     }
     parent::__construct();
     $this->quality = $this->config()->default_quality;
     $this->interlace = $this->config()->image_interlace;
 }
开发者ID:jakedaleweb,项目名称:AtomCodeChallenge,代码行数:32,代码来源:GD.php

示例8: run

 public function run($request)
 {
     $strCSVPath = CONTINENTAL_CONTENT_PATH . '/code/ThirdParty/dbip-city.csv';
     if (!file_exists($strCSVPath)) {
         echo "<p>I cant find the dbip-city.csv file to import any data.<br>\n\t\t\t\tPlease download any database from <a href='https://db-ip.com/db/'>https://db-ip.com/db/</a>.<br>\n\t\t\t\tNOTE: It's adviced to edit the DB to only include the countries you want to handle, it contains 2 million records!!!<br>\n\t\t\t\tOr make a CSV contain these columns<br>\n\t\t\t\t`IPFrom`,`IPTo`,`Country`,`Region`,`City`\n\t\t\t\t</p>";
         //"0.0.0.0","0.255.255.255","US","California","Los Angeles"
     } else {
         if (!isset($_REQUEST['confirm'])) {
             $strLink = Director::baseURL() . 'dev/tasks/ImportDBIPcom?confirm=1';
             echo "<p>CAUTION!!!<br>\n\t\t\t\t\tPlease confirm your action<br>\n\t\t\t\t\t<a href='{$strLink}'>I confirm the action</a><br>\n\t\t\t\t\t<a href='{$strLink}&emptydb=1'>I confirm the action, please empty the DB before you import</a>\n\t\t\t\t\t</p>";
         } else {
             increase_time_limit_to();
             if (isset($_REQUEST['emptydb'])) {
                 DB::query('TRUNCATE `IpToLocation`;');
             }
             $arrFields = array_keys(Config::inst()->get('IpToLocation', 'db'));
             $handle = fopen($strCSVPath, "r");
             if ($handle) {
                 while (($line = fgets($handle)) !== false) {
                     $line = str_replace('","', '___', $line);
                     $line = str_replace('"', '', $line);
                     $arrParts = Convert::raw2sql(explode("___", $line));
                     $arrParts[0] = ContinentalContentUtils::IPAddressToIPNumber($arrParts[0]);
                     $arrParts[1] = ContinentalContentUtils::IPAddressToIPNumber($arrParts[1]);
                     DB::query('INSERT INTO `IpToLocation` (`' . implode('`,`', $arrFields) . '`) VALUES (\'' . implode('\',\'', $arrParts) . '\')');
                 }
                 fclose($handle);
             } else {
                 echo 'Error opening file';
             }
         }
     }
 }
开发者ID:helpfulrobot,项目名称:silverstripers-continental-content,代码行数:33,代码来源:ImportDBIPcom.php

示例9: run

 /**
  * Perform migration
  *
  * @param string $base Absolute base path (parent of assets folder). Will default to BASE_PATH
  * @return int Number of files successfully migrated
  */
 public function run($base = null)
 {
     if (empty($base)) {
         $base = BASE_PATH;
     }
     // Check if the File dataobject has a "Filename" field.
     // If not, cannot migrate
     if (!DB::get_schema()->hasField('File', 'Filename')) {
         return 0;
     }
     // Set max time and memory limit
     increase_time_limit_to();
     increase_memory_limit_to();
     // Loop over all files
     $count = 0;
     $filenameMap = $this->getFilenameArray();
     foreach ($this->getFileQuery() as $file) {
         // Get the name of the file to import
         $filename = $filenameMap[$file->ID];
         $success = $this->migrateFile($base, $file, $filename);
         if ($success) {
             $count++;
         }
     }
     return $count;
 }
开发者ID:biggtfish,项目名称:silverstripe-framework,代码行数:32,代码来源:FileMigrationHelper.php

示例10: collectChanges

 /**
  * Collect all changes for the given context.
  */
 public function collectChanges($context)
 {
     increase_time_limit_to();
     increase_memory_limit_to();
     if (is_callable(array($this->owner, 'objectsToUpdate'))) {
         $toUpdate = $this->owner->objectsToUpdate($context);
         if ($toUpdate) {
             foreach ($toUpdate as $object) {
                 if (!is_callable(array($this->owner, 'urlsToCache'))) {
                     continue;
                 }
                 $urls = $object->urlsToCache();
                 if (!empty($urls)) {
                     $this->toUpdate = array_merge($this->toUpdate, $this->owner->getUrlArrayObject()->addObjects($urls, $object));
                 }
             }
         }
     }
     if (is_callable(array($this->owner, 'objectsToDelete'))) {
         $toDelete = $this->owner->objectsToDelete($context);
         if ($toDelete) {
             foreach ($toDelete as $object) {
                 if (!is_callable(array($this->owner, 'urlsToCache'))) {
                     continue;
                 }
                 $urls = $object->urlsToCache();
                 if (!empty($urls)) {
                     $this->toDelete = array_merge($this->toDelete, $this->owner->getUrlArrayObject()->addObjects($urls, $object));
                 }
             }
         }
     }
 }
开发者ID:spark-green,项目名称:silverstripe-staticpublishqueue,代码行数:36,代码来源:SiteTreePublishingEngine.php

示例11: sourceRecords

 /**
  * This returns the workflow requests outstanding for this user.
  * It does one query against draft for change requests, and another
  * request against live for the deletion requests (which are not in draft
  * any more), and merges the result sets together.
  */
 function sourceRecords($params)
 {
     increase_time_limit_to(120);
     $currentStage = Versioned::current_stage();
     $changes = WorkflowTwoStepRequest::get_by_author('WorkflowPublicationRequest', Member::currentUser(), array('AwaitingApproval'));
     if ($changes) {
         foreach ($changes as $change) {
             $change->RequestType = "Publish";
         }
     }
     Versioned::reading_stage(Versioned::get_live_stage());
     $deletions = WorkflowTwoStepRequest::get_by_author('WorkflowDeletionRequest', Member::currentUser(), array('AwaitingApproval'));
     if ($deletions) {
         foreach ($deletions as $deletion) {
             $deletion->RequestType = "Deletion";
         }
     }
     if ($changes && $deletions) {
         $changes->merge($deletions);
     } else {
         if ($deletions) {
             $changes = $deletions;
         }
     }
     return $changes;
 }
开发者ID:helpfulrobot,项目名称:silverstripe-cmsworkflow,代码行数:32,代码来源:MyTwoStepWorkflowRequests.php

示例12: fire

 public function fire()
 {
     increase_memory_limit_to();
     increase_time_limit_to();
     /** @var i18nTextCollector $collector */
     $collector = i18nTextCollector::create($this->option('locale'));
     if (!$this->option('locale')) {
         $this->info('Starting text collection. No Locale specified');
     } else {
         $this->info('Starting text collection for: ' . $this->option('locale'));
     }
     $merge = $this->getIsMerge();
     if ($merge) {
         $this->info('New strings will be merged with existing strings');
     }
     // Custom writer
     $writerName = $this->option('writer');
     if ($writerName) {
         $writer = Injector::inst()->get($writerName);
         $collector->setWriter($writer);
         $this->info('Set collector writer to: ' . $writer);
     }
     // Get restrictions
     $restrictModules = $this->option('module') ? explode(',', $this->option('module')) : null;
     $this->info('Collecting in modules: ' . $this->option('module'));
     // hack untill we have something better
     ob_start();
     $collector->run($restrictModules, $merge);
     $this->warn(ob_get_contents());
     ob_get_clean();
     $this->info(__CLASS__ . ' completed!');
 }
开发者ID:axyr,项目名称:silverstripe-console,代码行数:32,代码来源:TextCollectorCommand.php

示例13: run

 function run($request)
 {
     increase_time_limit_to();
     $self = get_class($this);
     $verbose = isset($_GET['verbose']);
     if (isset($_GET['class']) && isset($_GET['id'])) {
         $item = DataObject::get($_GET['class'])->byID($_GET['id']);
         if (!$item || !$item->exists()) {
             die('not found: ' . $_GET['id']);
         }
         $item->rebuildVFI();
         echo "done";
         return;
     }
     if (isset($_GET['link'])) {
         $item = SiteTree::get_by_link($_GET['link']);
         if (!$item || !$item->exists()) {
             die('not found: ' . $_GET['link']);
         }
         $item->rebuildVFI();
         echo "done";
         return;
     }
     if (isset($_GET['start'])) {
         $this->runFrom($_GET['class'], $_GET['start'], $_GET['field']);
     } else {
         foreach (array('framework', 'sapphire') as $dirname) {
             $script = sprintf("%s%s{$dirname}%scli-script.php", BASE_PATH, DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR);
             if (file_exists($script)) {
                 break;
             }
         }
         $classes = VirtualFieldIndex::get_classes_with_vfi();
         foreach ($classes as $class) {
             if (isset($_GET['class']) && $class != $_GET['class']) {
                 continue;
             }
             $singleton = singleton($class);
             $query = $singleton->get($class);
             $dtaQuery = $query->dataQuery();
             $sqlQuery = $dtaQuery->getFinalisedQuery();
             $singleton->extend('augmentSQL', $sqlQuery, $dtaQuery);
             $total = $query->count();
             $startFrom = isset($_GET['startfrom']) ? $_GET['startfrom'] : 0;
             $field = isset($_GET['field']) ? $_GET['field'] : '';
             echo "Class: {$class}, total: {$total}\n\n";
             for ($offset = $startFrom; $offset < $total; $offset += $this->stat('recordsPerRequest')) {
                 echo "{$offset}..";
                 $cmd = "php {$script} dev/tasks/{$self} class={$class} start={$offset} field={$field}";
                 if ($verbose) {
                     echo "\n  Running '{$cmd}'\n";
                 }
                 $res = $verbose ? passthru($cmd) : `{$cmd}`;
                 if ($verbose) {
                     echo "  " . preg_replace('/\\r\\n|\\n/', '$0  ', $res) . "\n";
                 }
             }
         }
     }
 }
开发者ID:helpfulrobot,项目名称:markguinn-silverstripe-shop-search,代码行数:60,代码来源:BuildVFI.php

示例14: setup

 /**
  * Note that this is duplicated for backwards compatibility purposes...
  */
 public function setup()
 {
     parent::setup();
     increase_time_limit_to();
     $restart = $this->currentStep == 0;
     if ($restart) {
         $this->pagesToProcess = DB::query('SELECT "ID" FROM SiteTree_Live WHERE ShowInSearch=1')->column();
     }
 }
开发者ID:kmayo-ss,项目名称:externallinks,代码行数:12,代码来源:CheckExternalLinksJob.php

示例15: run

 public function run($request)
 {
     $strLocationCSV = CONTINENTAL_CONTENT_PATH . '/code/ThirdParty/GeoLiteCity-Location.csv';
     $strIPCSV = CONTINENTAL_CONTENT_PATH . '/code/ThirdParty/GeoLiteCity-Blocks.csv';
     if (!file_exists($strLocationCSV) || !file_exists($strIPCSV)) {
         echo "<p>I cant find the GeoLiteCity-Location.csv or GeoLiteCity-Blocks.csv file to import any data.<br>\n\t\t\t\tPlease download the database from <a href='http://dev.maxmind.com/geoip/legacy/geolite/'>http://dev.maxmind.com/geoip/legacy/geolite/</a>.<br>\n\t\t\t\tNOTE: It's adviced to edit the DB to only include the countries you want to handle, it contains 2 million records!!!<br>\n\t\t\t\t</p>";
     } else {
         if (!isset($_REQUEST['confirm'])) {
             $strLink = Director::baseURL() . 'dev/tasks/ImportMaxMindToDatabase?confirm=1';
             echo "<p>CAUTION!!!<br>\n\t\t\t\t\tPlease confirm your action<br>\n\t\t\t\t\t<a href='{$strLink}'>I confirm the action</a><br>\n\t\t\t\t\t<a href='{$strLink}&emptydb=1'>I confirm the action, please empty the DB before you import</a>\n\t\t\t\t\t</p>";
         } else {
             $arrFields = array_keys(Config::inst()->get('IpToLocation', 'db'));
             increase_time_limit_to();
             if (isset($_REQUEST['emptydb'])) {
                 DB::query('TRUNCATE `IpToLocation`;');
             }
             $arrLocations = array();
             $handle = fopen($strLocationCSV, "r");
             if ($handle) {
                 $i = 0;
                 while (($line = fgets($handle)) !== false) {
                     $i += 1;
                     if ($i > 3) {
                         $line = str_replace('","', '**', $line);
                         $line = str_replace(',', '**', $line);
                         $line = str_replace('"', '', $line);
                         $arrParts = Convert::raw2sql(explode("**", $line));
                         $arrLocations[$arrParts[0]] = array('Country' => $arrParts[1], 'Region' => $arrParts[2], 'City' => $arrParts[3]);
                     }
                 }
                 fclose($handle);
             } else {
                 echo 'Error opening file';
             }
             $ipHandle = fopen($strIPCSV, "r");
             if ($ipHandle) {
                 $i = 0;
                 while (($line = fgets($ipHandle)) !== false) {
                     $i += 1;
                     if ($i > 3) {
                         $line = str_replace("\n", "", $line);
                         $line = str_replace('","', '___', $line);
                         $line = str_replace('"', '', $line);
                         $arrParts = Convert::raw2sql(explode("___", $line));
                         if (count($arrParts) == 3 && isset($arrLocations[$arrParts[2]])) {
                             $strSQL = 'INSERT INTO `IpToLocation` (`' . implode('`,`', $arrFields) . '`) VALUES (\'' . implode('\',\'', array_merge(array('IPFrom' => $arrParts[0], 'IPTo' => $arrParts[1]), $arrLocations[$arrParts[2]])) . '\')';
                             DB::query($strSQL);
                         }
                     }
                 }
             } else {
                 echo 'Error opening file';
             }
         }
     }
 }
开发者ID:helpfulrobot,项目名称:silverstripers-continental-content,代码行数:56,代码来源:ImportMaxMindToDatabase.php


注:本文中的increase_time_limit_to函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。