function gp_install() { global $gpdb; $errors = gp_upgrade_db(); if ($errors) { return $errors; } gp_update_option('uri', guess_uri()); }
function gp_install() { global $gpdb; $errors = gp_upgrade_db(); if ($errors) { return $errors; } gp_update_option('uri', guess_uri()); $gpdb->insert($gpdb->projects, array('name' => 'Sample', 'slug' => 'sample', 'description' => 'A Sample Project', 'path' => 'sample')); $gpdb->insert($gpdb->originals, array('project_id' => 1, 'singular' => 'GlotPress FTW', 'comment' => 'FTW means For The Win', 'context' => 'dashboard', 'references' => 'bigfile:666 little-dir/small-file.php:71')); $gpdb->insert($gpdb->originals, array('project_id' => 1, 'singular' => 'A GlotPress', 'plural' => 'Many GlotPresses')); $gpdb->insert($gpdb->translation_sets, array('name' => 'My Translation', 'slug' => 'my', 'project_id' => 1, 'locale' => 'bg')); // TODO: ask the user for an e-mail -- borrow WordPress install process if (!defined('CUSTOM_USER_TABLE')) { $admin = GP::$user->create(array('user_login' => 'admin', 'user_pass' => 'a', 'user_email' => '*****@*****.**')); GP::$permission->create(array('user_id' => $admin->id, 'action' => 'admin')); } // TODO: ask the user to choose an admin user if using custom table return array(); }
function _gp_get_salt($constants, $option = false) { if (!is_array($constants)) { $constants = array($constants); } foreach ($constants as $constant) { if (defined($constant)) { return constant($constant); } } if (!defined('GP_INSTALLING') || !GP_INSTALLING) { if (!$option) { $option = strtolower($constants[0]); } $salt = gp_get_option($option); if (empty($salt)) { $salt = gp_generate_password(); gp_update_option($option, $salt); } return $salt; } return ''; }
function setUp() { parent::setUp(); $this->url = '/gp/'; gp_update_option('uri', 'http://example.org' . $this->url); }