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


PHP set_time_limit函数代码示例

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


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

示例1: downloadPackage

 /**
  * Downloads a package
  *
  * @param string $url    URL of file to download
  * @param string $target Download target filename [optional]
  *
  * @return mixed Path to downloaded package or boolean false on failure
  *
  * @since   11.1
  */
 public static function downloadPackage($url, $target = false)
 {
     $config = JFactory::getConfig();
     // Capture PHP errors
     $track_errors = ini_get('track_errors');
     ini_set('track_errors', true);
     // Set user agent
     $version = new JVersion();
     ini_set('user_agent', $version->getUserAgent('Installer'));
     $http = JHttpFactory::getHttp();
     $response = $http->get($url);
     if (200 != $response->code) {
         JLog::add(JText::_('JLIB_INSTALLER_ERROR_DOWNLOAD_SERVER_CONNECT'), JLog::WARNING, 'jerror');
         return false;
     }
     if ($response->headers['wrapper_data']['Content-Disposition']) {
         $contentfilename = explode("\"", $response->headers['wrapper_data']['Content-Disposition']);
         $target = $contentfilename[1];
     }
     // Set the target path if not given
     if (!$target) {
         $target = $config->get('tmp_path') . '/' . self::getFilenameFromURL($url);
     } else {
         $target = $config->get('tmp_path') . '/' . basename($target);
     }
     // Write buffer to file
     JFile::write($target, $response->body);
     // Restore error tracking to what it was before
     ini_set('track_errors', $track_errors);
     // Bump the max execution time because not using built in php zip libs are slow
     @set_time_limit(ini_get('max_execution_time'));
     // Return the name of the downloaded package
     return basename($target);
 }
开发者ID:houzhenggang,项目名称:cobalt,代码行数:44,代码来源:helper.php

示例2: max

 /**
  * Max execution time.
  *
  * @since 150424 Initial release.
  *
  * @param int|null $max Max execution time.
  *
  * @return int Max execution time; in seconds.
  */
 public function max(int $max = null) : int
 {
     if (isset($max) && $max >= 0) {
         @set_time_limit($max);
     }
     return (int) ini_get('max_execution_time');
 }
开发者ID:websharks,项目名称:core,代码行数:16,代码来源:ExecTime.php

示例3: Copyright

/**
|--------------------------------------------------------------------------|
|   https://github.com/Bigjoos/                			    |
|--------------------------------------------------------------------------|
|   Licence Info: GPL			                                    |
|--------------------------------------------------------------------------|
|   Copyright (C) 2010 U-232 V5					    |
|--------------------------------------------------------------------------|
|   A bittorrent tracker source based on TBDev.net/tbsource/bytemonsoon.   |
|--------------------------------------------------------------------------|
|   Project Leaders: Mindless, Autotron, whocares, Swizzles.					    |
|--------------------------------------------------------------------------|
 _   _   _   _   _     _   _   _   _   _   _     _   _   _   _
/ \ / \ / \ / \ / \   / \ / \ / \ / \ / \ / \   / \ / \ / \ / \
( U | - | 2 | 3 | 2 )-( S | o | u | r | c | e )-( C | o | d | e )
\_/ \_/ \_/ \_/ \_/   \_/ \_/ \_/ \_/ \_/ \_/   \_/ \_/ \_/ \_/
*/
function docleanup($data)
{
    global $INSTALLER09, $queries, $mc1;
    set_time_limit(1200);
    ignore_user_abort(1);
    //== Delete inactive user accounts
    $secs = 350 * 86400;
    $dt = TIME_NOW - $secs;
    $maxclass = UC_STAFF;
    sql_query("SELECT FROM users WHERE parked='no' AND status='confirmed' AND class < {$maxclass} AND last_access < {$dt}");
    //== Delete parked user accounts
    $secs = 675 * 86400;
    // change the time to fit your needs
    $dt = TIME_NOW - $secs;
    $maxclass = UC_STAFF;
    sql_query("SELECT FROM users WHERE parked='yes' AND status='confirmed' AND class < {$maxclass} AND last_access < {$dt}");
    if ($queries > 0) {
        write_log("Inactive Clean -------------------- Inactive Clean Complete using {$queries} queries--------------------");
    }
    if (false !== mysqli_affected_rows($GLOBALS["___mysqli_ston"])) {
        $data['clean_desc'] = mysqli_affected_rows($GLOBALS["___mysqli_ston"]) . " items deleted/updated";
    }
    if ($data['clean_log']) {
        cleanup_log($data);
    }
}
开发者ID:Bigjoos,项目名称:U-232-V5,代码行数:43,代码来源:inactive_update.php

示例4: run

 /**
  * Standard modular run function.
  *
  * @return tempcode	Results
  */
 function run()
 {
     if (get_forum_type() != 'ocf') {
         return new ocp_tempcode();
     } else {
         ocf_require_all_forum_stuff();
     }
     if (function_exists('set_time_limit')) {
         @set_time_limit(0);
     }
     require_code('ocf_posts_action');
     require_code('ocf_posts_action2');
     // Members
     $start = 0;
     do {
         $members = $GLOBALS['FORUM_DB']->query_select('f_members', array('id'), NULL, '', 500, $start);
         foreach ($members as $member) {
             ocf_force_update_member_post_count($member['id']);
             $num_warnings = $GLOBALS['FORUM_DB']->query_value('f_warnings', 'COUNT(*)', array('w_member_id' => $member['id'], 'w_is_warning' => 1));
             $GLOBALS['FORUM_DB']->query_update('f_members', array('m_cache_warnings' => $num_warnings), array('id' => $member['id']), '', 1);
         }
         $start += 500;
     } while (array_key_exists(0, $members));
     return new ocp_tempcode();
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:30,代码来源:ocf_members.php

示例5: batch_show

 public function batch_show()
 {
     set_time_limit(0);
     $sql = "SELECT * FROM " . DB_PREFIX . "plat_token WHERE 1 ORDER BY lastusetime";
     $q = $this->db->query($sql);
     $plat_token = array();
     while ($row = $this->db->fetch_array($q)) {
         $plat_token[$row['type']] = $row;
     }
     include_once ROOT_PATH . 'lib/class/share.class.php';
     $this->share = new share();
     $sql = "SELECT id, uid, name, group_id FROM " . DB_PREFIX . "user WHERE 1 AND status = 1 ORDER BY update_time ASC LIMIT 100";
     $q = $this->db->query($sql);
     while ($row = $this->db->fetch_array($q)) {
         //先用授权人账号关注这个用户
         $token = $plat_token[$row['group_id']];
         $user_info = $this->share->get_user($row['uid'], $row['name'], $token['plat_token']);
         $user_info = $user_info[0];
         if ($user_info && $user_info['uid'] && !$user_info['error']) {
             $avatar = array('host' => $user_info['avatar'], 'dir' => '', 'filepath' => '', 'filename' => '');
             $user_info['avatar'] = $avatar;
             $sql = "UPDATE " . DB_PREFIX . "user SET  uid = '" . $user_info['uid'] . "', avatar = '" . serialize($avatar) . "', user_info = '" . serialize($user_info) . "' WHERE id = " . $row['id'];
             $this->db->query($sql);
         }
         $sql = "UPDATE " . DB_PREFIX . "user SET update_time = " . TIMENOW . " WHERE id = " . $row['id'];
         $this->db->query($sql);
         echo $row['id'];
         echo "<pre>";
         print_r($user_info);
         if ($user_info['error'] && $user_info['error'] != 'empty') {
             break;
         }
     }
 }
开发者ID:h3len,项目名称:Project,代码行数:34,代码来源:update_user_queue.php

示例6: dispatch

 /**
  * Registered callback function for the WordPress Importer
  *
  * Manages the three separate stages of the CSV import process
  */
 function dispatch()
 {
     $this->header();
     if (!empty($_POST['delimiter'])) {
         $this->delimiter = stripslashes(trim($_POST['delimiter']));
     }
     if (!$this->delimiter) {
         $this->delimiter = ',';
     }
     $step = empty($_GET['step']) ? 0 : (int) $_GET['step'];
     switch ($step) {
         case 0:
             $this->greet();
             break;
         case 1:
             check_admin_referer('import-upload');
             if ($this->handle_upload()) {
                 if ($this->id) {
                     $file = get_attached_file($this->id);
                 } else {
                     $file = ABSPATH . $this->file_url;
                 }
                 add_filter('http_request_timeout', array($this, 'bump_request_timeout'));
                 if (function_exists('gc_enable')) {
                     gc_enable();
                 }
                 @set_time_limit(0);
                 @ob_flush();
                 @flush();
                 $this->import($file);
             }
             break;
     }
     $this->footer();
 }
开发者ID:iplaydu,项目名称:Bob-Ellis-Shoes,代码行数:40,代码来源:tax-rates-importer.php

示例7: sync

 /**
  * Sync the media. Oh sync the media.
  *
  * @param string|null $path
  * @param SyncMedia   $syncCommand The SyncMedia command object, to log to console if executed by artisan.
  */
 public function sync($path = null, SyncMedia $syncCommand = null)
 {
     set_time_limit(env('APP_MAX_SCAN_TIME', 600));
     $path = $path ?: Setting::get('media_path');
     $results = ['good' => [], 'bad' => [], 'ugly' => []];
     // For now we only care about mp3 and ogg files.
     // Support for other formats (AAC?) may be added in the future.
     $files = Finder::create()->files()->name('/\\.(mp3|ogg)$/')->in($path);
     foreach ($files as $file) {
         $song = $this->syncFile($file);
         if ($song === true) {
             $results['ugly'][] = $file;
         } elseif ($song === false) {
             $results['bad'][] = $file;
         } else {
             $results['good'][] = $file;
         }
         if ($syncCommand) {
             $syncCommand->logToConsole($file->getPathname(), $song);
         }
     }
     // Delete non-existing songs.
     $hashes = array_map(function ($f) {
         return $this->getHash($f->getPathname());
     }, array_merge($results['ugly'], $results['good']));
     Song::whereNotIn('id', $hashes)->delete();
     // Empty albums and artists should be gone as well.
     $inUseAlbums = Song::select('album_id')->groupBy('album_id')->get()->lists('album_id');
     $inUseAlbums[] = Album::UNKNOWN_ID;
     Album::whereNotIn('id', $inUseAlbums)->delete();
     $inUseArtists = Album::select('artist_id')->groupBy('artist_id')->get()->lists('artist_id');
     $inUseArtists[] = Artist::UNKNOWN_ID;
     Artist::whereNotIn('id', $inUseArtists)->delete();
 }
开发者ID:Holdlen2DH,项目名称:koel,代码行数:40,代码来源:Media.php

示例8: generate

 /**
  * @param $file_name
  * @return array
  * @throws ApplicationException
  */
 public static function generate($file_name)
 {
     set_time_limit(0);
     $temp_file = TempFileProvider::generate("peaks", ".raw");
     $command = sprintf("%s -v quiet -i %s -ac 1 -f u8 -ar 11025 -acodec pcm_u8 %s", self::$ffmpeg_cmd, escapeshellarg($file_name), escapeshellarg($temp_file));
     shell_exec($command);
     if (!file_exists($temp_file)) {
         throw new ApplicationException("Waveform could not be generated!");
     }
     $chunk_size = ceil(filesize($temp_file) / self::PEAKS_RESOLUTION);
     $peaks = withOpenedFile($temp_file, "r", function ($fh) use(&$chunk_size) {
         while ($data = fread($fh, $chunk_size)) {
             $peak = 0;
             $array = str_split($data);
             foreach ($array as $item) {
                 $code = ord($item);
                 if ($code > $peak) {
                     $peak = $code;
                 }
                 if ($code == 255) {
                     break;
                 }
             }
             (yield $peak - 127);
         }
     });
     TempFileProvider::delete($temp_file);
     return $peaks;
 }
开发者ID:pldin601,项目名称:HomeMusic,代码行数:34,代码来源:WaveformGenerator.php

示例9: init

 public static function init()
 {
     if (!is_admin()) {
         return;
     }
     if (!isset($_FILES['podlove_import_tracking'])) {
         return;
     }
     set_time_limit(10 * MINUTE_IN_SECONDS);
     // allow xml+gz uploads
     add_filter('upload_mimes', function ($mimes) {
         return array_merge($mimes, array('xml' => 'application/xml', 'gz|gzip' => 'application/x-gzip'));
     });
     require_once ABSPATH . '/wp-admin/includes/file.php';
     $file = wp_handle_upload($_FILES['podlove_import_tracking'], array('test_form' => false));
     if ($file && (!isset($file['error']) || !$file['error'])) {
         update_option('podlove_import_tracking_file', $file['file']);
         if (!($file = get_option('podlove_import_tracking_file'))) {
             return;
         }
         $importer = new \Podlove\Modules\ImportExport\Import\TrackingImporter($file);
         $importer->import();
     } else {
         echo '<div class="error"><p>' . $file['error'] . '</p></div>';
     }
 }
开发者ID:johannes-mueller,项目名称:podlove-publisher,代码行数:26,代码来源:tracking_importer.php

示例10: indexAction

 /**
  * Data export action
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function indexAction()
 {
     // Export time execution depends on entities exported
     ignore_user_abort(false);
     set_time_limit(0);
     return $this->createStreamedResponse()->send();
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:12,代码来源:ExportController.php

示例11: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     ini_set('memory_limit', -1);
     set_time_limit(0);
     $this->output = $output;
     $this->em = $this->getContainer()->get('doctrine')->getManager();
     $siteId = (int) $input->getOption('site_id');
     $this->site = $this->em->getRepository('SudouxCmsSiteBundle:Site')->find($siteId);
     if (!isset($this->site)) {
         throw new \Exception("Site was not found");
     }
     $availableFunctions = array('import_branches_from_csv');
     $function = $input->getArgument('function');
     if (!in_array($function, $availableFunctions)) {
         throw new \Exception("Function does not exist");
     }
     switch ($function) {
         case 'import_branches_from_csv':
             $csvPath = $input->getOption('csv_path');
             if (empty($csvPath)) {
                 throw new \Exception("Option --csv_path cannot be empty");
             }
             $this->importBranchesFromCsv($csvPath);
             break;
     }
 }
开发者ID:eric19h,项目名称:turbulent-wookie,代码行数:26,代码来源:BranchCommand.php

示例12: export_csv

 public function export_csv($page = 1)
 {
     set_time_limit(0);
     $limit = ($page - 1) * intval(app_conf("BATCH_PAGE_SIZE")) . "," . intval(app_conf("BATCH_PAGE_SIZE"));
     $map['ecv_type_id'] = intval($_REQUEST['ecv_type_id']);
     $list = M(MODULE_NAME)->where($map)->limit($limit)->findAll();
     if ($list) {
         register_shutdown_function(array(&$this, 'export_csv'), $page + 1);
         $ecv_value = array('sn' => '""', 'password' => '""', 'money' => '""', 'use_limit' => '""', 'begin_time' => '""', 'end_time' => '""');
         if ($page == 1) {
             $content = iconv("utf-8", "gbk", "序列号,密码,面额,使用数量,生效时间,过期时间");
             $content = $content . "\n";
         }
         foreach ($list as $k => $v) {
             $ecv_value['sn'] = '"' . iconv('utf-8', 'gbk', $v['sn']) . '"';
             $ecv_value['password'] = '"' . iconv('utf-8', 'gbk', $v['password']) . '"';
             $ecv_value['money'] = '"' . iconv('utf-8', 'gbk', format_price($v['money'])) . '"';
             $ecv_value['use_limit'] = '"' . iconv('utf-8', 'gbk', $v['use_limit']) . '"';
             $ecv_value['begin_time'] = '"' . iconv('utf-8', 'gbk', to_date($v['begin_time'])) . '"';
             $ecv_value['end_time'] = '"' . iconv('utf-8', 'gbk', to_date($v['end_time'])) . '"';
             $content .= implode(",", $ecv_value) . "\n";
         }
         header("Content-Disposition: attachment; filename=voucher_list.csv");
         echo $content;
     } else {
         if ($page == 1) {
             $this->error(L("NO_RESULT"));
         }
     }
 }
开发者ID:dalinhuang,项目名称:zsh_business,代码行数:30,代码来源:EcvAction.class.php

示例13: __construct

 public function __construct()
 {
     parent::__construct();
     $this->load->helper('upload');
     $this->load->model('Image');
     set_time_limit(0);
 }
开发者ID:sasha8-1,项目名称:instagram,代码行数:7,代码来源:UploadImage.php

示例14: docleanup

function docleanup($data)
{
    global $INSTALLER09, $queries, $mc1;
    set_time_limit(1200);
    ignore_user_abort(1);
    //== delete torrents - ????
    $days = 30;
    $dt = TIME_NOW - $days * 86400;
    sql_query("UPDATE torrents SET flags='1' WHERE added < {$dt} AND seeders='0' AND leechers='0'") or sqlerr(__FILE__, __LINE__);
    $res = sql_query("SELECT id, name FROM torrents WHERE mtime < {$dt} AND seeders='0' AND leechers='0' AND flags='1'") or sqlerr(__FILE__, __LINE__);
    while ($arr = mysqli_fetch_assoc($res)) {
        sql_query("DELETE files.*, comments.*, thankyou.*, thanks.*, thumbsup.*, bookmarks.*, coins.*, rating.*, xbt_files_users.* FROM xbt_files_users\n                                 LEFT JOIN files ON files.torrent = xbt_files_users.fid\n                                 LEFT JOIN comments ON comments.torrent = xbt_files_users.fid\n                                 LEFT JOIN thankyou ON thankyou.torid = xbt_files_users.fid\n                                 LEFT JOIN thanks ON thanks.torrentid = xbt_files_users.fid\n                                 LEFT JOIN bookmarks ON bookmarks.torrentid = xbt_files_users.fid\n                                 LEFT JOIN coins ON coins.torrentid = xbt_files_users.fid\n                                 LEFT JOIN rating ON rating.torrent = xbt_files_users.fid\n                                 LEFT JOIN thumbsup ON thumbsup.torrentid = xbt_files_users.fid\n                                 WHERE xbt_files_users.fid =" . sqlesc($arr['id'])) or sqlerr(__FILE__, __LINE__);
        @unlink("{$INSTALLER09['torrent_dir']}/{$arr['id']}.torrent");
        write_log("Torrent " . (int) $arr['id'] . " (" . htmlsafechars($arr['name']) . ") was deleted by system (older than {$days} days and no seeders)");
    }
    if ($queries > 0) {
        write_log("Delete Old Torrents XBT Clean -------------------- Delete Old XBT Torrents cleanup Complete using {$queries} queries --------------------");
    }
    if (false !== mysqli_affected_rows($GLOBALS["___mysqli_ston"])) {
        $data['clean_desc'] = mysqli_affected_rows($GLOBALS["___mysqli_ston"]) . " items deleted/updated";
    }
    if ($data['clean_log']) {
        cleanup_log($data);
    }
}
开发者ID:UniversalAdministrator,项目名称:U-232-V4,代码行数:25,代码来源:delete_torrents_xbt_update.php

示例15: download_as_dataformat

/**
 * Sends a formated data file to the browser
 *
 * @package    core
 * @subpackage dataformat
 *
 * @param string $filename The base filename without an extension
 * @param string $dataformat A dataformat name
 * @param array $columns An ordered map of column keys and labels
 * @param Iterator $iterator An iterator over the records, usually a RecordSet
 * @param function $callback An option function applied to each record before writing
 * @param mixed $extra An optional value which is passed into the callback function
 */
function download_as_dataformat($filename, $dataformat, $columns, $iterator, $callback = null)
{
    if (ob_get_length()) {
        throw new coding_exception("Output can not be buffered before calling download_as_dataformat");
    }
    $classname = 'dataformat_' . $dataformat . '\\writer';
    if (!class_exists($classname)) {
        throw new coding_exception("Unable to locate dataformat/{$type}/classes/writer.php");
    }
    $format = new $classname();
    // The data format export could take a while to generate...
    set_time_limit(0);
    // Close the session so that the users other tabs in the same session are not blocked.
    \core\session\manager::write_close();
    $format->set_filename($filename);
    $format->send_http_headers();
    $format->write_header($columns);
    $c = 0;
    foreach ($iterator as $row) {
        if ($callback) {
            $row = $callback($row);
        }
        if ($row === null) {
            continue;
        }
        $format->write_record($row, $c++);
    }
    $format->write_footer($columns);
}
开发者ID:gabrielrosset,项目名称:moodle,代码行数:42,代码来源:dataformatlib.php


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