本文整理汇总了PHP中StatusNet::initDefaults方法的典型用法代码示例。如果您正苦于以下问题:PHP StatusNet::initDefaults方法的具体用法?PHP StatusNet::initDefaults怎么用?PHP StatusNet::initDefaults使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StatusNet
的用法示例。
在下文中一共展示了StatusNet::initDefaults方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doInstall
/**
* The beef of the installer!
* Create database, config file, and admin user.
*
* Prerequisites: validation of input data.
*
* @return boolean success
*/
function doInstall()
{
$this->updateStatus("Initializing...");
ini_set('display_errors', 1);
error_reporting(E_ALL);
if (!defined('STATUSNET')) {
define('STATUSNET', 1);
}
require_once INSTALLDIR . '/lib/framework.php';
StatusNet::initDefaults($this->server, $this->path);
try {
$this->db = $this->setupDatabase();
if (!$this->db) {
// database connection failed, do not move on to create config file.
return false;
}
} catch (Exception $e) {
// Lower-level DB error!
$this->updateStatus("Database error: " . $e->getMessage(), true);
return false;
}
// Make sure we can write to the file twice
$oldUmask = umask(00);
if (!$this->skipConfig) {
$this->updateStatus("Writing config file...");
$res = $this->writeConf();
if (!$res) {
$this->updateStatus("Can't write config file.", true);
return false;
}
}
if (!empty($this->adminNick)) {
// Okay, cross fingers and try to register an initial user
if ($this->registerInitialUser()) {
$this->updateStatus("An initial user with the administrator role has been created.");
} else {
$this->updateStatus("Could not create initial StatusNet user (administrator).", true);
return false;
}
}
if (!$this->skipConfig) {
$this->updateStatus("Setting site profile...");
$res = $this->writeSiteProfile();
if (!$res) {
$this->updateStatus("Can't write to config file.", true);
return false;
}
}
// Restore original umask
umask($oldUmask);
// Set permissions back to something decent
chmod(INSTALLDIR . '/config.php', 0644);
/*
TODO https needs to be considered
*/
$link = "http://" . $this->server . '/' . $this->path;
$this->updateStatus("StatusNet has been installed at {$link}");
$this->updateStatus("<strong>DONE!</strong> You can visit your <a href='{$link}'>new StatusNet site</a> (login as '{$this->adminNick}'). If this is your first StatusNet install, you may want to poke around our <a href='http://status.net/wiki/Getting_started'>Getting Started guide</a>.");
return true;
}
示例2: init
/**
* Initialize, or re-initialize, StatusNet global configuration
* and plugins.
*
* If switching site configurations during script execution, be
* careful when working with leftover objects -- global settings
* affect many things and they may not behave as you expected.
*
* @param $server optional web server hostname for picking config
* @param $path optional URL path for picking config
* @param $conffile optional configuration file path
*
* @throws NoConfigException if config file can't be found
*/
public static function init($server = null, $path = null, $conffile = null)
{
StatusNet::initDefaults($server, $path);
StatusNet::loadConfigFile($conffile);
// Load settings from database; note we need autoload for this
Config::loadSettings();
self::initPlugins();
}
示例3: init
/**
* Initialize, or re-initialize, StatusNet global configuration
* and plugins.
*
* If switching site configurations during script execution, be
* careful when working with leftover objects -- global settings
* affect many things and they may not behave as you expected.
*
* @param $server optional web server hostname for picking config
* @param $path optional URL path for picking config
* @param $conffile optional configuration file path
*
* @throws NoConfigException if config file can't be found
*/
public static function init($server = null, $path = null, $conffile = null)
{
Router::clear();
StatusNet::initDefaults($server, $path);
StatusNet::loadConfigFile($conffile);
$sprofile = common_config('site', 'profile');
if (!empty($sprofile)) {
StatusNet::loadSiteProfile($sprofile);
}
// Load settings from database; note we need autoload for this
Config::loadSettings();
self::initPlugins();
}