本文整理汇总了PHP中build_cron_next_run函数的典型用法代码示例。如果您正苦于以下问题:PHP build_cron_next_run函数的具体用法?PHP build_cron_next_run怎么用?PHP build_cron_next_run使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了build_cron_next_run函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: disable
/**
* Disable a product, not delete
*
*/
public function disable($productid = null)
{
$productid = $productid ? $productid : $this->productinfo['productid'];
$this->db->query_write("\n\t\t\tUPDATE " . TABLE_PREFIX . "product\n\t\t\tSET active = 0\n\t\t\tWHERE productid = '" . $this->db->escape_string($productid) . "'\n\t\t");
vBulletinHook::build_datastore($this->db);
build_product_datastore();
// build bitfields to remove/add this products bitfields
require_once DIR . '/includes/class_bitfield_builder.php';
vB_Bitfield_Builder::save($this->db);
// Products can enable a cron entries, so we need to rebuild that as well
require_once DIR . '/includes/functions_cron.php';
build_cron_next_run();
// Purge cache -- doesn't apply to pre-vB4 versions
if (class_exists('vB_Cache')) {
vB_Cache::instance()->purge('vb_types.types');
}
// Reload blocks and block types -- doesn't apply to pre-vB4 versions
if (class_exists('vB_BlockManager')) {
$blockmanager = vB_BlockManager::create($this->registry);
$blockmanager->reloadBlockTypes();
$blockmanager->getBlocks(true, true);
}
}
示例2: exec_cron
function exec_cron($cronid = NULL)
{
global $vbulletin, $workingdir, $subscriptioncache;
if ($cronid = intval($cronid)) {
$nextitem = $vbulletin->db->query_first_slave("\n\t\t\tSELECT *\n\t\t\tFROM " . TABLE_PREFIX . "cron\n\t\t\tWHERE cronid = {$cronid}\n\t\t");
} else {
$nextitem = $vbulletin->db->query_first("\n\t\t\tSELECT cron.*\n\t\t\tFROM " . TABLE_PREFIX . "cron AS cron\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "product AS product ON (cron.product = product.productid)\n\t\t\tWHERE cron.nextrun <= " . TIMENOW . " AND cron.active = 1\n\t\t\t\tAND (product.productid IS NULL OR product.active = 1)\n\t\t\tORDER BY cron.nextrun\n\t\t\tLIMIT 1\n\t\t");
}
if ($nextitem) {
if ($nextrun = build_cron_item($nextitem['cronid'], $nextitem)) {
include_once DIR . '/' . $nextitem['filename'];
}
} else {
build_cron_next_run();
}
($hook = vBulletinHook::fetch_hook('cron_complete')) ? eval($hook) : false;
}
示例3: vB_Database_Alter_MySQL
require_once DIR . '/includes/class_dbalter.php';
$db_alter = new vB_Database_Alter_MySQL($db);
if ($db_alter->fetch_table_info('language')) {
$phrasetypes = $db->query_read("\r\n\t\t\tSELECT fieldname\r\n\t\t\tFROM " . TABLE_PREFIX . "phrasetype\r\n\t\t\tWHERE product = '" . $db->escape_string($vbulletin->GPC['productid']) . "'\r\n\t\t");
while ($phrasetype = $db->fetch_array($phrasetypes)) {
$db_alter->drop_field("phrasegroup_{$phrasetype['fieldname']}");
}
}
delete_product($vbulletin->GPC['productid']);
build_all_styles();
vBulletinHook::build_datastore($db);
require_once DIR . '/includes/adminfunctions_language.php';
build_language();
build_options();
require_once DIR . '/includes/functions_cron.php';
build_cron_next_run();
build_product_datastore();
// build bitfields to remove/add this products bitfields
require_once DIR . '/includes/class_bitfield_builder.php';
vB_Bitfield_Builder::save($db);
// reload block types
$blockmanager = vB_BlockManager::create($vbulletin);
$blockmanager->reloadBlockTypes(true);
if (!defined('DISABLE_PRODUCT_REDIRECT')) {
define('CP_REDIRECT', 'index.php?loc=' . urlencode('plugin.php?do=product'));
}
print_stop_message('product_x_uninstalled', $vbulletin->GPC['productid']);
}
// #############################################################################
if ($_REQUEST['do'] == 'productdelete') {
$vbulletin->input->clean_array_gpc('r', array('productid' => TYPE_STR));
示例4: step_7
/**
* Step #7 - Default User Setup...
*
*/
function step_7($data = null)
{
if ($data['response']) {
array_map('trim', $data['htmldata']);
$errors = array();
if (empty($data['htmldata']['username'])) {
$errors['username'] = $this->phrase['install']['error_username'];
}
if (empty($data['htmldata']['email']) or !is_valid_email($data['htmldata']['email'])) {
$errors['email'] = $this->phrase['install']['error_email'];
}
if (empty($data['htmldata']['password']) or empty($data['htmldata']['confirmpassword'])) {
if (empty($data['htmldata']['password'])) {
$errors['password'] = $this->phrase['install']['error_password'];
} else {
if (empty($data['htmldata']['confirmpassword'])) {
$errors['confirmpassword'] = $this->phrase['install']['error_confirmpassword'];
}
}
} else {
if ($data['htmldata']['password'] != $data['htmldata']['confirmpassword']) {
$errors['mismatch'] = $this->phrase['install']['error_password_not_match'];
} else {
if ($data['htmldata']['password'] == $data['htmldata']['username'] and !defined('ALLOW_SAME_USERNAME_PASSWORD')) {
$errors['samepasswordasusername'] = $this->phrase['install']['error_same_password_as_username'];
}
}
}
// check if a user already exists. If so, DO NOT CREATE A NEW USER.
$vbexists = $this->fetch_vbexists();
if (!$vbexists) {
$errors[] = $this->phrase['install']['user_table_missing'];
// we can't create a user without a user table.
} else {
// assuming if user table exists, userid will exist. If a user exists, DO NOT CREATE A NEW USER
if ($this->db->query_first("SELECT userid FROM " . trim($this->registry->config['Database']['tableprefix']) . "user LIMIT 1")) {
$errors[] = $this->phrase['install']['user_already_exists'];
}
}
if (empty($errors)) {
require_once DIR . '/includes/class_bitfield_builder.php';
vB_Bitfield_Builder::save($this->db);
$admin_defaults = array('vbasset_enable', 'showsignatures', 'showavatars', 'showimages', 'adminemail', 'dstauto', 'receivepm', 'showusercss', 'receivefriendemailrequest', 'vm_enable');
$admin_useroption = 0;
foreach ($admin_defaults as $bitfield) {
$admin_useroption |= $this->registry->bf_misc_useroptions["{$bitfield}"];
}
require_once DIR . '/includes/functions_user.php';
//for now we'll just include these to get the define for the salt length. Should investigate
//using the DM to add the initial admin user, but there may be issues with doing that without
//a proper user session (which we can't have until we require the user.
require_once DIR . '/includes/class_dm.php';
require_once DIR . '/includes/class_dm_user.php';
$salt = fetch_user_salt(SALT_LENGTH);
/*insert query*/
$this->db->query_write("\n\t\t\t\t\tINSERT INTO " . TABLE_PREFIX . "user\n\t\t\t\t\t\t(username, salt, password, email, usertitle, joindate, lastvisit, lastactivity, usergroupid, passworddate, options, showvbcode)\n\t\t\t\t\tVALUES (\n\t\t\t\t\t\t'" . $this->db->escape_string(htmlspecialchars_uni($data['htmldata']['username'])) . "',\n\t\t\t\t\t\t'" . $this->db->escape_string($salt) . "',\n\t\t\t\t\t\t'" . $this->db->escape_string(md5(md5($data['htmldata']['password']) . $salt)) . "',\n\t\t\t\t\t\t'" . $this->db->escape_string($data['htmldata']['email']) . "',\n\t\t\t\t\t\t'" . $this->db->escape_string($this->phrase['install']['usergroup_admin_usertitle']) . "',\n\t\t\t\t\t\t" . TIMENOW . ",\n\t\t\t\t\t\t" . TIMENOW . ",\n\t\t\t\t\t\t" . TIMENOW . ",\n\t\t\t\t\t\t6,\n\t\t\t\t\t\tFROM_UNIXTIME(" . TIMENOW . "),\n\t\t\t\t\t\t{$admin_useroption},\n\t\t\t\t\t\t2\n\t\t\t\t\t)\n\t\t\t\t");
$userid = $this->db->insert_id();
/*insert query*/
$this->db->query_write("\n\t\t\t\t\tINSERT INTO " . TABLE_PREFIX . "usertextfield\n\t\t\t\t\t\t(userid)\n\t\t\t\t\tVALUES\n\t\t\t\t\t\t({$userid})\n\t\t\t\t");
/*insert query*/
$this->db->query_write("\n\t\t\t\t\tINSERT INTO " . TABLE_PREFIX . "userfield\n\t\t\t\t\t\t(userid)\n\t\t\t\t\tVALUES\n\t\t\t\t\t\t({$userid})\n\t\t\t\t");
/*insert query*/
$this->db->query_write("INSERT INTO " . TABLE_PREFIX . "administrator\n\t\t\t\t\t(userid, adminpermissions)\n\t\t\t\tVALUES\n\t\t\t\t\t({$userid}, " . (array_sum($this->registry->bf_ugp_adminpermissions) - 3) . ")\n\t\t\t\t");
/*insert query*/
$this->db->query_write("INSERT INTO " . TABLE_PREFIX . "moderator\n\t\t\t\t\t(userid, forumid, permissions, permissions2)\n\t\t\t\tVALUES\n\t\t\t\t\t(\n\t\t\t\t\t\t{$userid},\n\t\t\t\t\t\t-1,\n\t\t\t\t\t\t" . (array_sum($this->registry->bf_misc_moderatorpermissions) - ($this->registry->bf_misc_moderatorpermissions['newthreademail'] + $this->registry->bf_misc_moderatorpermissions['newpostemail'])) . ",\n\t\t\t\t\t\t" . array_sum($this->registry->bf_misc_moderatorpermissions2) . "\n\t\t\t\t\t)\n\t\t\t\t");
build_image_cache('smilie');
build_image_cache('avatar');
build_image_cache('icon');
build_bbcode_cache();
require_once DIR . '/includes/functions_databuild.php';
build_user_statistics();
require_once DIR . '/includes/adminfunctions_forums.php';
build_forum_child_lists();
build_forum_permissions();
require_once DIR . '/includes/functions_cron.php';
build_cron_next_run();
require_once DIR . '/includes/adminfunctions_attachment.php';
build_attachment_permissions();
require_once DIR . '/includes/class_block.php';
$blockmanager = vB_BlockManager::create($this->registry);
$blockmanager->reloadBlockTypes();
$this->show_message($this->phrase['install']['administrator_account_created']);
return;
} else {
foreach ($errors as $key => $value) {
$errors["{$key}"] = '<span class="usererror">' . $value . '</span>';
}
}
} else {
$data['htmldata'] = array();
}
$html = '<table cellspacing="0" cellpadding="4" border="0" align="center" width="100%" id="cpform_table" class="" style="border-collapse: separate;">
<tbody>
<tr valign="top">
<td class="alt1">' . $this->phrase['install']['username'] . $errors['username'] . '
<span id="htmldata[username]_error" class="usererror hidden">' . $this->phrase['install']['field_required'] . '</span>
//.........这里部分代码省略.........
示例5: exec_cron
function exec_cron($cronid = NULL)
{
global $vbulletin, $workingdir, $subscriptioncache;
if ($cronid = intval($cronid))
{
$nextitem = $vbulletin->db->query_first_slave("
SELECT *
FROM " . TABLE_PREFIX . "cron
WHERE cronid = $cronid
");
}
else
{
$nextitem = $vbulletin->db->query_first("
SELECT cron.*
FROM " . TABLE_PREFIX . "cron AS cron
LEFT JOIN " . TABLE_PREFIX . "product AS product ON (cron.product = product.productid)
WHERE cron.nextrun <= " . TIMENOW . " AND cron.active = 1
AND (product.productid IS NULL OR product.active = 1)
ORDER BY cron.nextrun
LIMIT 1
");
}
if ($nextitem)
{
if ($nextrun = build_cron_item($nextitem['cronid'], $nextitem))
{
include_once(DIR . '/' . $nextitem['filename']);
}
}
else
{
build_cron_next_run();
}
//make sure that shutdown functions are called on script exit.
$GLOBALS['vbulletin']->shutdown->shutdown();
($hook = vBulletinHook::fetch_hook('cron_complete')) ? eval($hook) : false;
}
示例6: install_product
//.........这里部分代码省略.........
" . intval($faq['displayorder']) . ",
1,
'" . $db->escape_string($info['productid']) . "')
";
}
if ($sql)
{
/*insert query*/
$db->query_write("
REPLACE INTO " . TABLE_PREFIX . "faq
(faqname, faqparent, displayorder, volatile, product)
VALUES
" . implode(',', $sql) . "
");
}
}
// Check if the plugin system is disabled. If it is, enable it.
if (!$vbulletin->options['enablehooks'])
{
$db->query_write("
UPDATE " . TABLE_PREFIX . "setting
SET value = '1'
WHERE varname = 'enablehooks'
");
$rebuild['options'] = true;
}
// Now rebuild everything we need...
if ($rebuild['plugins'])
{
vBulletinHook::build_datastore($db);
if ($active)
{
$plugin_data = $db->query_read("
SELECT *
FROM " . TABLE_PREFIX . "datastore
WHERE title IN ('pluginlist', 'pluginlistadmin')
");
while ($plugin_info = $db->fetch_array($plugin_data))
{
if ($plugin_info['title'] == 'pluginlist')
{
$vbulletin->pluginlist = unserialize($plugin_info['data']);
}
else if ($plugin_info['title'] == 'pluginlistadmin')
{
$vbulletin->pluginlistadmin = unserialize($plugin_info['data']);
}
}
// enable any hooks -- this is mainly necessary for importing templates (template_safe_functions hook)
if (!defined('DISABLE_HOOKS'))
{
if (!empty($vbulletin->pluginlistadmin) AND is_array($vbulletin->pluginlistadmin))
{
$vbulletin->pluginlist = array_merge($vbulletin->pluginlist, $vbulletin->pluginlistadmin);
unset($vbulletin->pluginlistadmin);
}
vBulletinHook::set_pluginlist($vbulletin->pluginlist);
}
}
}
if ($rebuild['templates'])
{
build_all_styles();
}
if ($rebuild['phrases'])
{
require_once(DIR . '/includes/adminfunctions_language.php');
build_language();
}
if ($rebuild['options'])
{
build_options();
}
if ($rebuild['cron'])
{
require_once(DIR . '/includes/functions_cron.php');
build_cron_next_run();
}
build_product_datastore();
// build bitfields to remove/add this products bitfields
vB_Bitfield_Builder::save($db);
// reload block types
$blockmanager = vB_BlockManager::create($vbulletin);
$blockmanager->reloadBlockTypes();
print_dots_stop();
$info['need_merge'] = ($rebuild['templates'] AND $installed_version);
return $info;
}
示例7: prepare_next_page
/**
* Prepares for the next "page" of building. Handles parent functions and
* updates the cron to run almost immediately (to allow a multi-page build
* to be completed quickly.
*
* @return boolean
*/
protected function prepare_next_page()
{
if (!parent::prepare_next_page()) {
return false;
}
if ($this->cron_item) {
// if we have more to do, run the next step in approximately a minute
$this->registry->db->query_write("UPDATE " . TABLE_PREFIX . "cron SET nextrun = " . (TIMENOW + 60) . " WHERE cronid = " . intval($this->cron_item['cronid']));
build_cron_next_run(TIMENOW + 60);
}
return true;
}
示例8: install_product
//.........这里部分代码省略.........
$scheduling['day'] = intval($scheduling['day']);
$scheduling['hour'] = intval($scheduling['hour']);
$scheduling['minute'] = explode(',', preg_replace('#[^0-9,-]#i', '', $scheduling['minute']));
if (count($scheduling['minute']) == 0) {
$scheduling['minute'] = array(0);
} else {
$scheduling['minute'] = array_map('intval', $scheduling['minute']);
}
/*insert query*/
$cronSql[] = array('weekday' => $scheduling['weekday'], 'day' => $scheduling['day'], 'hour' => $scheduling['hour'], 'minute' => serialize($scheduling['minute']), 'filename' => $cron['filename'], 'loglevel' => $cron['loglevel'], 'active' => $cron['active'], 'varname' => $cron['varname'], 'volatile' => 1, 'product' => $info['productid']);
$cronid = $assertor->assertQuery('replaceValues', array('values' => $cronSql, 'table' => 'cron', 'returnId' => true));
if ($cronid) {
build_cron_item($cronid);
}
$rebuild['cron'] = true;
}
}
// ############## import faq
if (isset($arr['faqentries']['faq']) and is_array($arr['faqentries']['faq'])) {
$faq_entries =& $arr['faqentries']['faq'];
if (!isset($faq_entries[0])) {
$faq_entries = array($faq_entries);
}
$sql = array();
foreach ($faq_entries as $faq) {
$sql[] = array('faqname' => $faq['faqname'], 'faqparent' => $faq['faqparent'], 'displayorder' => intval($faq['displayorder']), 'volatile' => 1, 'product' => $info['productid']);
}
if ($sql) {
/*insert query*/
$assertor->assertQuery('replaceValues', array('values' => $sql, 'table' => 'faq'));
}
}
// ############## import widgets
if (isset($arr['widgets']['widget']) and is_array($arr['widgets']['widget'])) {
$widgetImporter = new vB_Xml_Import_Widget($info['productid']);
$widgetImporter->importFromParsedXML($arr['widgets']);
}
// ############## import pagetemplates
if (isset($arr['pagetemplates']['pagetemplate']) and is_array($arr['pagetemplates']['pagetemplate'])) {
$pageTemplateImporter = new vB_Xml_Import_PageTemplate($info['productid']);
$pageTemplateImporter->importFromParsedXML($arr['pagetemplates']);
}
// ############## import page
if (isset($arr['pages']['page']) and is_array($arr['pages']['page'])) {
$pageImporter = new vB_Xml_Import_Page($info['productid']);
$pageImporter->importFromParsedXML($arr['pages']);
}
// ############## import channels
if (isset($arr['channels']['channel']) and is_array($arr['channels']['channel'])) {
$channelImporter = new vB_Xml_Import_Channel($info['productid']);
$channelImporter->importFromParsedXML($arr['channels']);
}
// ############## import routes
if (isset($arr['routes']['route']) and is_array($arr['routes']['route'])) {
$routeImporter = new vB_Xml_Import_Route($info['productid']);
$routeImporter->importFromParsedXML($arr['routes']);
}
if (isset($routeImporter)) {
// update pages and channels with new route ids
if (isset($pageImporter)) {
$pageImporter->updatePageRoutes();
}
if (isset($channelImporter)) {
$channelImporter->updateChannelRoutes();
}
}
// Check if the hook system is disabled. If it is, enable it.
if (!$vbulletin->options['enablehooks']) {
$assertor->update('setting', array('value' => 1), array('varname' => 'enablehooks'));
$rebuild['options'] = true;
}
// Now rebuild everything we need...
if ($rebuild['hooks']) {
vB_Api::instanceInternal("Hook")->buildHookDatastore();
}
if ($rebuild['templates']) {
if ($error = build_all_styles(0, 0, '', false, $verbose)) {
return $error;
}
}
if ($rebuild['phrases']) {
require_once DIR . '/includes/adminfunctions_language.php';
build_language();
}
if ($rebuild['options']) {
vB::getDatastore()->build_options();
}
if ($rebuild['cron']) {
require_once DIR . '/includes/functions_cron.php';
build_cron_next_run();
}
build_product_datastore();
// build bitfields to remove/add this products bitfields
vB_Bitfield_Builder::save();
if ($verbose) {
print_dots_stop();
}
$info['need_merge'] = ($rebuild['templates'] and $installed_version);
return $info;
}
示例9: exec_cron
function exec_cron($cronid = NULL)
{
if ($cronid = intval($cronid)) {
$nextitem = vB::getDbAssertor()->getRow('cron', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_SELECT, 'cronid' => $cronid));
} else {
$nextitem = vB::getDbAssertor()->getRow('vBForum:fetchCronByDate', array('date' => vB::getRequest()->getTimeNow()));
}
if ($nextitem) {
if ($nextrun = build_cron_item($nextitem['cronid'], $nextitem)) {
include_once DIR . '/' . $nextitem['filename'];
}
} else {
build_cron_next_run();
}
//make sure that shutdown functions are called on script exit.
$GLOBALS['vbulletin']->shutdown->shutdown();
// Legacy Hook 'cron_complete' Removed //
}
示例10: switchActive
/**
* Toggle the enable/disable status of a cron
*
* @param int $cronid Cron ID
*
* @return void
*/
public function switchActive($cronid)
{
$this->checkHasAdminPermission('canadmincron');
$cronid = intval($cronid);
$cron = vB::getDbAssertor()->getRow('cron_fetchswitch', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_STORED, 'cronid' => $cronid));
if (!$cron) {
$vboptions = vB::getDatastore()->get_value('options');
throw new vB_Exception_Api('invalidid', array('cronid'));
} else {
if (!$cron['product_active']) {
throw new vB_Exception_Api('task_not_enabled_product_x_disabled', array(htmlspecialchars_uni($cron['product_title'])));
}
}
vB::getDbAssertor()->assertQuery('cron_switchactive', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_STORED, 'cronid' => $cronid));
require_once DIR . '/includes/functions_cron.php';
build_cron_item($cronid);
build_cron_next_run();
}