本文整理汇总了PHP中elgg_get_upgrade_files函数的典型用法代码示例。如果您正苦于以下问题:PHP elgg_get_upgrade_files函数的具体用法?PHP elgg_get_upgrade_files怎么用?PHP elgg_get_upgrade_files使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了elgg_get_upgrade_files函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upgrade_module_run
/**
* Process upgrades for the videolist plugin
*/
function upgrade_module_run($module)
{
$path = elgg_get_plugins_path() . "{$module}/upgrades/";
$files = elgg_get_upgrade_files($path);
foreach ($files as $file) {
include "{$path}{$file}";
}
}
示例2: file_tools_upgrade_handler
function file_tools_upgrade_handler()
{
$upgrades_path = dirname(dirname(__FILE__)) . "/upgrades/";
// find all upgrade files
$upgrade_files = elgg_get_upgrade_files($upgrades_path);
// get processed upgrade file, so we can add our own files when done
$processed_upgrades = elgg_get_processed_upgrades();
// get unprocessed upgrade files
if ($unprocessed_upgrades = elgg_get_unprocessed_upgrades($upgrade_files, $processed_upgrades)) {
foreach ($unprocessed_upgrades as $upgrade_file) {
// make sure we don't try to run someone elses upgrade files
if (in_array($upgrade_file, $upgrade_files) && file_exists($upgrades_path . $upgrade_file)) {
// run upgrade
include $upgrades_path . $upgrade_file;
// make sure we don't do it again
$processed_upgrades[] = $upgrade_file;
}
}
// store processed upgrade files
elgg_set_processed_upgrades($processed_upgrades);
}
}
示例3: groups_run_upgrades
/**
* Process upgrades for the groups plugin
*/
function groups_run_upgrades()
{
$path = __DIR__ . '/upgrades/';
$files = elgg_get_upgrade_files($path);
foreach ($files as $file) {
include "{$path}{$file}";
}
}
示例4: groups_run_upgrades
/**
* Process upgrades for the groups plugin
*/
function groups_run_upgrades()
{
$path = elgg_get_plugins_path() . 'groups/upgrades/';
$files = elgg_get_upgrade_files($path);
foreach ($files as $file) {
include "{$path}{$file}";
}
}
示例5: saveSiteSettings
/**
* Initialize the site including site entity, plugins, and configuration
*
* @param array $submissionVars Submitted vars
*
* @return bool
*/
protected function saveSiteSettings($submissionVars)
{
global $CONFIG;
// ensure that file path, data path, and www root end in /
$submissionVars['path'] = sanitise_filepath($submissionVars['path']);
$submissionVars['dataroot'] = sanitise_filepath($submissionVars['dataroot']);
$submissionVars['wwwroot'] = sanitise_filepath($submissionVars['wwwroot']);
$site = new ElggSite();
$site->name = $submissionVars['sitename'];
$site->url = $submissionVars['wwwroot'];
$site->access_id = ACCESS_PUBLIC;
$site->email = $submissionVars['siteemail'];
$guid = $site->save();
if (!$guid) {
register_error(elgg_echo('install:error:createsite'));
return FALSE;
}
// bootstrap site info
$CONFIG->site_guid = $guid;
$CONFIG->site = $site;
datalist_set('installed', time());
datalist_set('path', $submissionVars['path']);
datalist_set('dataroot', $submissionVars['dataroot']);
datalist_set('default_site', $site->getGUID());
datalist_set('version', get_version());
datalist_set('simplecache_enabled', 1);
datalist_set('system_cache_enabled', 1);
// new installations have run all the upgrades
$upgrades = elgg_get_upgrade_files($submissionVars['path'] . 'engine/lib/upgrades/');
datalist_set('processed_upgrades', serialize($upgrades));
set_config('view', 'default', $site->getGUID());
set_config('language', 'en', $site->getGUID());
set_config('default_access', $submissionVars['siteaccess'], $site->getGUID());
set_config('allow_registration', TRUE, $site->getGUID());
set_config('walled_garden', FALSE, $site->getGUID());
set_config('allow_user_default_access', '', $site->getGUID());
$this->enablePlugins();
return TRUE;
}
示例6: saveSiteSettings
/**
* Initialize the site including site entity, plugins, and configuration
*
* @param array $submissionVars Submitted vars
*
* @return bool
*/
protected function saveSiteSettings($submissionVars)
{
// ensure that file path, data path, and www root end in /
$submissionVars['dataroot'] = sanitise_filepath($submissionVars['dataroot']);
$submissionVars['wwwroot'] = sanitise_filepath($submissionVars['wwwroot']);
$site = new ElggSite();
$site->name = strip_tags($submissionVars['sitename']);
$site->url = $submissionVars['wwwroot'];
$site->access_id = ACCESS_PUBLIC;
$site->email = $submissionVars['siteemail'];
$guid = $site->save();
if (!$guid) {
register_error(_elgg_services()->translator->translate('install:error:createsite'));
return FALSE;
}
// bootstrap site info
$this->CONFIG->site_guid = $guid;
$this->CONFIG->site = $site;
_elgg_services()->configTable->set('installed', time());
_elgg_services()->configTable->set('dataroot', $submissionVars['dataroot']);
_elgg_services()->configTable->set('default_site', $site->getGUID());
_elgg_services()->configTable->set('version', elgg_get_version());
_elgg_services()->configTable->set('simplecache_enabled', 1);
_elgg_services()->configTable->set('system_cache_enabled', 1);
_elgg_services()->configTable->set('simplecache_lastupdate', time());
// new installations have run all the upgrades
$upgrades = elgg_get_upgrade_files(\Elgg\Application::elggDir()->getPath("/engine/lib/upgrades/"));
_elgg_services()->configTable->set('processed_upgrades', $upgrades);
_elgg_services()->configTable->set('view', 'default', $site->getGUID());
_elgg_services()->configTable->set('language', 'en', $site->getGUID());
_elgg_services()->configTable->set('default_access', $submissionVars['siteaccess'], $site->getGUID());
_elgg_services()->configTable->set('allow_registration', TRUE, $site->getGUID());
_elgg_services()->configTable->set('walled_garden', FALSE, $site->getGUID());
_elgg_services()->configTable->set('allow_user_default_access', '', $site->getGUID());
_elgg_services()->configTable->set('default_limit', 10, $site->getGUID());
_elgg_services()->configTable->set('security_protect_upgrade', true, $site->getGUID());
_elgg_services()->configTable->set('security_notify_admins', true, $site->getGUID());
_elgg_services()->configTable->set('security_notify_user_password', true, $site->getGUID());
_elgg_services()->configTable->set('security_email_require_password', true, $site->getGUID());
$this->setSubtypeClasses();
$this->enablePlugins();
return TRUE;
}
示例7: thewire_run_upgrades
function thewire_run_upgrades()
{
$path = dirname(__FILE__) . '/upgrades/';
$files = elgg_get_upgrade_files($path);
foreach ($files as $file) {
include $path . $file;
}
}
示例8: videolist_run_upgrades
/**
* Process upgrades for the videolist plugin
*/
function videolist_run_upgrades()
{
$path = elgg_get_plugins_path() . 'videolist/upgrades/';
$files = elgg_get_upgrade_files($path);
foreach ($files as $file) {
include "{$path}{$file}";
}
}
示例9: elgg_get_unprocessed_upgrades
/**
* Checks if any upgrades need to be run.
*
* @param null|array $upgrade_files Optional upgrade files
* @param null|array $processed_upgrades Optional processed upgrades
*
* @return array()
*/
function elgg_get_unprocessed_upgrades($upgrade_files = null, $processed_upgrades = null)
{
if ($upgrade_files === null) {
$upgrade_files = elgg_get_upgrade_files();
}
if ($processed_upgrades === null) {
$processed_upgrades = unserialize(datalist_get('processed_upgrades'));
if (!is_array($processed_upgrades)) {
$processed_upgrades = array();
}
}
$unprocessed = array_diff($upgrade_files, $processed_upgrades);
return $unprocessed;
}
示例10: saveSiteSettings
/**
* Initialize the site including site entity, plugins, and configuration
*
* @param array $submissionVars Submitted vars
*
* @return bool
*/
protected function saveSiteSettings($submissionVars)
{
// ensure that file path, data path, and www root end in /
$submissionVars['dataroot'] = sanitise_filepath($submissionVars['dataroot']);
$submissionVars['wwwroot'] = sanitise_filepath($submissionVars['wwwroot']);
$site = new ElggSite();
$site->name = strip_tags($submissionVars['sitename']);
$site->url = $submissionVars['wwwroot'];
$site->access_id = ACCESS_PUBLIC;
$site->email = $submissionVars['siteemail'];
$guid = $site->save();
if (!$guid) {
register_error(_elgg_services()->translator->translate('install:error:createsite'));
return FALSE;
}
// bootstrap site info
$this->CONFIG->site_guid = $guid;
$this->CONFIG->site_id = $guid;
$this->CONFIG->site = $site;
_elgg_services()->datalist->set('installed', time());
_elgg_services()->datalist->set('dataroot', $submissionVars['dataroot']);
_elgg_services()->datalist->set('default_site', $site->getGUID());
_elgg_services()->datalist->set('version', elgg_get_version());
_elgg_services()->datalist->set('simplecache_enabled', 1);
_elgg_services()->datalist->set('system_cache_enabled', 1);
_elgg_services()->datalist->set('simplecache_lastupdate', time());
// @todo plugins might use this, but core doesn't. remove in 2.0
_elgg_services()->datalist->set('path', $this->CONFIG->path);
// new installations have run all the upgrades
$upgrades = elgg_get_upgrade_files("{$this->CONFIG->path}engine/lib/upgrades/");
_elgg_services()->datalist->set('processed_upgrades', serialize($upgrades));
_elgg_services()->configTable->set('view', 'default', $site->getGUID());
_elgg_services()->configTable->set('language', 'en', $site->getGUID());
_elgg_services()->configTable->set('default_access', $submissionVars['siteaccess'], $site->getGUID());
_elgg_services()->configTable->set('allow_registration', TRUE, $site->getGUID());
_elgg_services()->configTable->set('walled_garden', FALSE, $site->getGUID());
_elgg_services()->configTable->set('allow_user_default_access', '', $site->getGUID());
_elgg_services()->configTable->set('default_limit', 10, $site->getGUID());
$this->setSubtypeClasses();
$this->enablePlugins();
return TRUE;
}
示例11: elgg_upgrade_bootstrap_17_to_18
/**
* Boot straps into 1.8 upgrade system from 1.7
*
* This runs all the 1.7 upgrades, then sets the processed_upgrades to all existing 1.7 upgrades.
* Control is then passed back to the main upgrade function which detects and runs the
* 1.8 upgrades, regardless of filename convention.
*
* @return bool
* @access private
*/
function elgg_upgrade_bootstrap_17_to_18()
{
$db_version = (int) datalist_get('version');
// the 1.8 upgrades before the upgrade system change that are interspersed with 1.7 upgrades.
$upgrades_18 = array('2010111501.php', '2010121601.php', '2010121602.php', '2010121701.php', '2010123101.php', '2011010101.php');
$upgrade_files = elgg_get_upgrade_files();
$processed_upgrades = array();
foreach ($upgrade_files as $upgrade_file) {
// ignore if not in 1.7 format or if it's a 1.8 upgrade
if (in_array($upgrade_file, $upgrades_18) || !preg_match("/[0-9]{10}\\.php/", $upgrade_file)) {
continue;
}
$upgrade_version = elgg_get_upgrade_file_version($upgrade_file);
// this has already been run in a previous 1.7.X -> 1.7.X upgrade
if ($upgrade_version < $db_version) {
$processed_upgrades[] = $upgrade_file;
}
}
return elgg_set_processed_upgrades($processed_upgrades);
}