本文整理汇总了PHP中ignore_user_abort函数的典型用法代码示例。如果您正苦于以下问题:PHP ignore_user_abort函数的具体用法?PHP ignore_user_abort怎么用?PHP ignore_user_abort使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ignore_user_abort函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
}
示例2: DeleteLyrics3
function DeleteLyrics3()
{
// Initialize getID3 engine
$getID3 = new getID3();
$ThisFileInfo = $getID3->analyze($this->filename);
if (isset($ThisFileInfo['lyrics3']['tag_offset_start']) && isset($ThisFileInfo['lyrics3']['tag_offset_end'])) {
if (is_readable($this->filename) && is_writable($this->filename) && is_file($this->filename) && ($fp = fopen($this->filename, 'a+b'))) {
flock($fp, LOCK_EX);
$oldignoreuserabort = ignore_user_abort(true);
fseek($fp, $ThisFileInfo['lyrics3']['tag_offset_end'], SEEK_SET);
$DataAfterLyrics3 = '';
if ($ThisFileInfo['filesize'] > $ThisFileInfo['lyrics3']['tag_offset_end']) {
$DataAfterLyrics3 = fread($fp, $ThisFileInfo['filesize'] - $ThisFileInfo['lyrics3']['tag_offset_end']);
}
ftruncate($fp, $ThisFileInfo['lyrics3']['tag_offset_start']);
if (!empty($DataAfterLyrics3)) {
fseek($fp, $ThisFileInfo['lyrics3']['tag_offset_start'], SEEK_SET);
fwrite($fp, $DataAfterLyrics3, strlen($DataAfterLyrics3));
}
flock($fp, LOCK_UN);
fclose($fp);
ignore_user_abort($oldignoreuserabort);
return true;
} else {
$this->errors[] = 'Cannot fopen(' . $this->filename . ', "a+b")';
return false;
}
}
// no Lyrics3 present
return true;
}
示例3: acyqueueHelper
public function acyqueueHelper()
{
$this->config = acymailing_config();
$this->subClass = acymailing_get('class.subscriber');
$this->listsubClass = acymailing_get('class.listsub');
$this->listsubClass->checkAccess = false;
$this->listsubClass->sendNotif = false;
$this->listsubClass->sendConf = false;
$this->send_limit = (int) $this->config->get('queue_nbmail', 40);
acymailing_increasePerf();
@ini_set('default_socket_timeout', 10);
@ignore_user_abort(true);
$timelimit = intval(ini_get('max_execution_time'));
if (empty($timelimit)) {
$timelimit = 600;
}
$calculatedTimeout = $this->config->get('max_execution_time');
if (!empty($calculatedTimeout) && $calculatedTimeout < $timelimit) {
$timelimit = $calculatedTimeout;
}
if (!empty($timelimit)) {
$this->stoptime = time() + $timelimit - 4;
}
$this->db = JFactory::getDBO();
}
示例4: css_store_css
/**
* Stores CSS in a file at the given path.
*
* This function either succeeds or throws an exception.
*
* @param theme_config $theme The theme that the CSS belongs to.
* @param string $csspath The path to store the CSS at.
* @param string $csscontent the complete CSS in one string
* @param bool $chunk If set to true these files will be chunked to ensure
* that no one file contains more than 4095 selectors.
* @param string $chunkurl If the CSS is be chunked then we need to know the URL
* to use for the chunked files.
*/
function css_store_css(theme_config $theme, $csspath, $csscontent, $chunk = false, $chunkurl = null)
{
global $CFG;
clearstatcache();
if (!file_exists(dirname($csspath))) {
@mkdir(dirname($csspath), $CFG->directorypermissions, true);
}
// Prevent serving of incomplete file from concurrent request,
// the rename() should be more atomic than fwrite().
ignore_user_abort(true);
// First up write out the single file for all those using decent browsers.
css_write_file($csspath, $csscontent);
if ($chunk) {
// If we need to chunk the CSS for browsers that are sub-par.
$css = css_chunk_by_selector_count($csscontent, $chunkurl);
$files = count($css);
$count = 1;
foreach ($css as $content) {
if ($count === $files) {
// If there is more than one file and this IS the last file.
$filename = preg_replace('#\\.css$#', '.0.css', $csspath);
} else {
// If there is more than one file and this is not the last file.
$filename = preg_replace('#\\.css$#', '.' . $count . '.css', $csspath);
}
$count++;
css_write_file($filename, $content);
}
}
ignore_user_abort(false);
if (connection_aborted()) {
die;
}
}
示例5: fes_22_upgrade_vendor_permissions
/**
* Upgrades vendor permissions
*
* @since 2.2
* @return void
*/
function fes_22_upgrade_vendor_permissions()
{
$fes_version = get_option('fes_db_version', '2.1');
if (version_compare($fes_version, '2.2', '>=')) {
return;
}
ignore_user_abort(true);
if (!edd_is_func_disabled('set_time_limit') && !ini_get('safe_mode')) {
set_time_limit(0);
}
$step = isset($_GET['step']) ? absint($_GET['step']) : 1;
$offset = $step == 1 ? 0 : $step * 100;
$users = new WP_User_Query(array('fields' => 'ID', 'number' => 100, 'offset' => $offset));
$users = $users->results;
if ($users && count($users) > 0) {
foreach ($users as $user => $id) {
if (user_can($id, 'fes_is_vendor') && !user_can($id, 'fes_is_admin') && !user_can($id, 'administrator') && !user_can($id, 'editor')) {
$user = new WP_User($id);
$user->add_role('frontend_vendor');
}
}
// Keys found so upgrade them
$step++;
$redirect = add_query_arg(array('page' => 'fes-upgrades', 'edd_upgrade' => 'upgrade_vendor_permissions', 'step' => $step), admin_url('index.php'));
wp_redirect($redirect);
exit;
} else {
// No more keys found, update the DB version and finish up
update_option('fes_db_version', fes_plugin_version);
wp_redirect(admin_url('admin.php?page=fes-about'));
exit;
}
}
示例6: execute
/**
* Add (export) several products to Google Content
*
* @return \Magento\Framework\Controller\ResultInterface
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function execute()
{
$flag = $this->_getFlag();
if ($flag->isLocked()) {
return $this->resultFactory->create(\Magento\Framework\Controller\ResultFactory::TYPE_RAW);
}
session_write_close();
ignore_user_abort(true);
set_time_limit(0);
$storeId = $this->_getStore()->getId();
$productIds = $this->getRequest()->getParam('product', null);
try {
$flag->lock();
$this->_objectManager->create('Magento\\GoogleShopping\\Model\\MassOperations')->setFlag($flag)->addProducts($productIds, $storeId);
} catch (\Zend_Gdata_App_CaptchaRequiredException $e) {
// Google requires CAPTCHA for login
$this->messageManager->addError(__($e->getMessage()));
$flag->unlock();
return $this->_redirectToCaptcha($e);
} catch (\Exception $e) {
$flag->unlock();
$this->notifier->addMajor(__('Something went wrong while adding products to the Google shopping account.'), $e->getMessage());
$this->_objectManager->get('Psr\\Log\\LoggerInterface')->critical($e);
return $this->resultFactory->create(\Magento\Framework\Controller\ResultFactory::TYPE_RAW);
}
$flag->unlock();
return $this->resultFactory->create(\Magento\Framework\Controller\ResultFactory::TYPE_RAW);
}
示例7: init
public function init()
{
if (file_exists($this->sock)) {
$this->log->error("Sock file already exists, concurrent process cannot be started");
exit;
}
$this->log->info('Streamer initialization');
// connection keep-alive, in other case browser will close it when receive last frame
header('Connection: keep-alive');
// disable caches
header('Cache-Control: no-cache');
header('Cache-Control: private');
header('Pragma: no-cache');
// x-mixed-replace to stream JPEG images
header('Content-type: multipart/x-mixed-replace; boundary=' . self::$BOUNDARY);
// set unlimited so PHP doesn't timeout during a long stream
set_time_limit(0);
// ignore user abort script
ignore_user_abort(true);
@apache_setenv('no-gzip', 1);
// disable apache gzip compression
@ini_set('zlib.output_compression', 0);
// disable PHP zlib compression
@ini_set('implicit_flush', 1);
// flush all current buffers
$k = ob_get_level();
for ($i = 0; $i < $k; $i++) {
ob_end_flush();
}
register_shutdown_function(array($this, 'shutdown'));
fclose(fopen($this->sock, 'w'));
$this->initialized = true;
}
示例8: WYSIJA_help_queue
/**
*
*/
function WYSIJA_help_queue()
{
$this->config = WYSIJA::get('config', 'model');
$this->subClass = WYSIJA::get('user', 'model');
//acymailing_get('class.sub');
$this->listsubClass = WYSIJA::get('user_list', 'model');
//acymailing_get('class.listsub');
$this->listsubClass->checkAccess = false;
$this->listsubClass->sendNotif = false;
$this->listsubClass->sendConf = false;
$is_multisite = is_multisite();
//$is_multisite=true;//PROD comment that line
// get the right sending limit based on the setup we are on,
// if we are on a multisite we need to see which sending method is used to determine that
if ($is_multisite && $this->config->getValue('sending_method') == 'network') {
$this->send_limit = (int) $this->config->getValue('ms_sending_emails_number');
} else {
$this->send_limit = (int) $this->config->getValue('sending_emails_number');
}
if (isset($_REQUEST['totalsend'])) {
$this->send_limit = (int) $_REQUEST['totalsend'] - $_REQUEST['alreadysent'];
}
@ini_set('max_execution_time', 0);
@ini_set('default_socket_timeout', 10);
@ignore_user_abort(true);
//we set a stoppage time to avoid broken process
$time_limit = ini_get('max_execution_time');
if (!empty($time_limit)) {
$this->stoptime = time() + $time_limit - 4;
}
}
示例9: Display
function Display($pView = null, $pData = array())
{
ignore_user_abort(true);
$Model = $this->GetModel();
$Model->Retrieve();
while ($Model->Fetch()) {
$Task = $Model->Get('Task');
$Tasks[$Task] = strtotime($Model->Get('Updated'));
}
// Run the janitor every minute.
// TODO: Make this configurable.
if (!$this->_IsPast($Tasks['Janitorial'], 1)) {
return true;
}
$Model->Set('Updated', NOW());
$Model->Save(array('Task' => 'Janitorial'));
// Process the newsfeed every FIVE minutes.
// TODO: Make this configurable.
if ($this->_IsPast($Tasks['ProcessNewsfeed'], 5)) {
$this->Talk('Newsfeed', 'ProcessQueue');
$Model->Set('Updated', NOW());
$Model->Save(array('Task' => 'ProcessNewsfeed'));
}
// Update the node network every 24 hours.
// TODO: Make this configurable.
if ($this->_IsPast($Tasks['UpdateNodeNetwork'], 1440)) {
$this->GetSys('Event')->Trigger('Update', 'Node', 'Network');
$Model->Set('Updated', NOW());
$Model->Save(array('Task' => 'UpdateNodeNetwork'));
}
return true;
}
示例10: __construct
public function __construct()
{
// Enforce time limit, ignore aborts
set_time_limit(2);
ignore_user_abort();
// Load constants
require_once 'system/core/constants.php';
// Set error reporting (debuging mode)
if (debug) {
error_reporting(E_ALL ^ E_DEPRECATED);
}
// Load security
require_once 'system/core/security.php';
// Load dependencies
require_once 'system/core/dependencies.php';
// Session handling
date_default_timezone_set(local_timezone);
session_start();
// Initialize the stack (stack routing)
Stack::Push((isset($_REQUEST[route_key]) and trim($_REQUEST[route_key]) != '') ? $_REQUEST[route_key] : route_home);
// Initialize buffering
ob_start();
// Cycle the processes stack, run all the processors sucessively until the stack is empty.
while (Stack::Ahead() > 0) {
// Pre-init / re-init 'found' flag (in case the stack had multiple items)
$found = false;
// Catch anything that might happen
try {
foreach (route_repos as $rep => $types) {
if (!is_array($types)) {
$types = array($types);
}
foreach ($types as $t) {
$p = $rep . Stack::Top() . $t;
if (is_file($p)) {
$found = true;
// Update the output sequencer
Output::Path(Stack::Path());
if (!(include $p)) {
throw new SystemException(sprintf(err_include500, Stack::Top()));
}
break 2;
}
}
}
if (!$found) {
throw new SystemException(sprintf(err_include404, Stack::Top()));
}
// Processor completed; pop the stack
Stack::Pop();
} catch (Exception $e) {
throw new SystemException($e);
}
}
$this->buffer = ob_get_contents();
ob_end_clean();
// Pass the buffer to the output handler for final render
Output::Flush($this->buffer);
exit(1);
}
示例11: docleanup
function docleanup($data)
{
global $INSTALLER09, $queries;
set_time_limit(1200);
ignore_user_abort(1);
$sql = sql_query("SHOW TABLE STATUS FROM {$INSTALLER09['mysql_db']}");
$oht = '';
while ($row = mysqli_fetch_assoc($sql)) {
if ($row['Data_free'] > 100) {
$oht .= $row['Data_free'] . ',';
}
}
$oht = rtrim($oht, ',');
if ($oht != '') {
$sql = sql_query("OPTIMIZE TABLE {$oht}");
}
if ($queries > 0) {
write_log("Auto-optimizedb--------------------Auto Optimization Complete using {$queries} queries --------------------");
}
if ($oht != '') {
$data['clean_desc'] = "MySQLCleanup optimized {$oht} table(s)";
}
if ($data['clean_log']) {
cleanup_log($data);
}
}
示例12: execute
/**
* 执行
*
* @author Garbin
* @param none
* @return void
*/
function execute()
{
//此处的锁定机制可能存在冲突问题
/* 被锁定 */
if ($this->is_lock()) {
return;
}
/* 在运行结束前锁定 */
@set_time_limit(1800);
//半个小时
@ignore_user_abort(true);
//忽略用户退出
$this->lock();
$this->_init_tasks();
/* 获取到期的任务列表 */
$due_tasks = $this->get_due_tasks();
/* 没有到期的任务 */
if (empty($due_tasks)) {
$this->unlock();
return;
}
/* 执行任务 */
$this->run_task($due_tasks);
/* 更新任务列表 */
$this->update_tasks($due_tasks);
/* 解锁 */
$this->unlock();
}
示例13: start_send_wechat
function start_send_wechat()
{
session_write_close();
ignore_user_abort(true);
set_time_limit(0);
$this->_global("send_wechat_running", true);
$timemap = $this->_global("send_wechat_timemap");
$diff = time() - $timemap;
if ($diff > 3) {
while (true) {
$flag = $this->_global("send_wechat_running");
if (empty($flag)) {
exit;
}
sleep(1);
$this->_global("send_wechat_timemap", time());
$where = array();
$where['westatus'] = array('eq', 1);
$data = D("PushView")->where($where)->find();
//$test=dump($data,false);
//$this->wechat_test($test);
$where['id'] = $data['id'];
if ($data) {
M("Push")->delete($data['id']);
//$this->wechat_test($test);
$this->send_wechat($data['info'], $data['openid']);
}
}
} else {
dump("Y1");
}
}
示例14: eddcr_upgrade_post_meta
/**
* Upgrades all commission records to use a taxonomy for tracking the status of the commission
*
* @since 2.8
* @return void
*/
function eddcr_upgrade_post_meta()
{
if (!current_user_can('manage_shop_settings')) {
return;
}
define('EDDCR_DOING_UPGRADES', true);
ignore_user_abort(true);
if (!edd_is_func_disabled('set_time_limit') && !ini_get('safe_mode')) {
set_time_limit(0);
}
$step = isset($_GET['step']) ? absint($_GET['step']) : 1;
$args = array('posts_per_page' => 20, 'paged' => $step, 'status' => 'any', 'order' => 'ASC', 'post_type' => 'any', 'fields' => 'ids', 'meta_key' => '_edd_cr_restricted_to');
$items = get_posts($args);
if ($items) {
// items found so upgrade them
foreach ($items as $post_id) {
$restricted_to = get_post_meta($post_id, '_edd_cr_restricted_to', true);
$price_id = get_post_meta($post_id, '_edd_cr_restricted_to_variable', true);
$args = array();
$args[] = array('download' => $restricted_to, 'price_id' => $price_id);
update_post_meta($post_id, '_edd_cr_restricted_to', $args);
add_post_meta($restricted_to, '_edd_cr_protected_post', $post_id);
}
$step++;
$redirect = add_query_arg(array('page' => 'edd-upgrades', 'edd-upgrade' => 'upgrade_cr_post_meta', 'step' => $step), admin_url('index.php'));
wp_safe_redirect($redirect);
exit;
} else {
// No more items found, finish up
update_option('eddcr_version', EDD_CONTENT_RESTRICTION_VER);
delete_option('edd_doing_upgrade');
wp_redirect(admin_url());
exit;
}
}
示例15: execute
/**
* {@inheritdoc}
*/
public function execute()
{
$flag = $this->_getFlag();
if ($flag->isLocked()) {
return;
}
session_write_close();
ignore_user_abort(true);
set_time_limit(0);
$itemIds = $this->getRequest()->getParam('item');
try {
$flag->lock();
$operation = $this->operation;
$this->_objectManager->create('Magento\\GoogleShopping\\Model\\MassOperations')->setFlag($flag)->{$operation}($itemIds);
} catch (\Zend_Gdata_App_CaptchaRequiredException $e) {
// Google requires CAPTCHA for login
$this->messageManager->addError(__($e->getMessage()));
$flag->unlock();
$this->_redirectToCaptcha($e);
return;
} catch (\Exception $e) {
$flag->unlock();
$this->notifier->addMajor(__('An error has occurred while deleting products from google shopping account.'), __('One or more products were not deleted from google shopping account. Refer to the log file for details.'));
$this->_objectManager->get('Psr\\Log\\LoggerInterface')->critical($e);
return;
}
$flag->unlock();
}