本文整理汇总了PHP中Check::good方法的典型用法代码示例。如果您正苦于以下问题:PHP Check::good方法的具体用法?PHP Check::good怎么用?PHP Check::good使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Check
的用法示例。
在下文中一共展示了Check::good方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Exception
$res = Database::RunFolder($root . '/protected/install/database/schema/');
if (true !== $res) {
throw new Exception('Error loading database schema:<br/><div class="nested-error">' . $res . '</div>');
}
// Save the new version
@file_put_contents($root . '/protected/install/database/version', DATABASE_VERSION);
Check::good('[' . date('H:i:s') . '] Loaded database schema.');
$subs = array('username' => $_POST['config_username'], 'userpass' => md5($_POST['config_password']));
$res = Database::RunFile($root . '/protected/install/database/data/add_user.sql', $subs);
if (true !== $res) {
throw new Exception('Error loading database data:<br/><div class="nested-error">' . $res . '</div>');
}
Check::good('[' . date('H:i:s') . '] Loaded database data.');
$substitutions = array('mysql_host' => $_POST['mysql_host'], 'mysql_database' => $_POST['mysql_database'], 'mysql_password' => $_POST['mysql_password'], 'mysql_username' => $_POST['mysql_user'], 'security_cookie' => sha1(time() . $_SERVER['SERVER_NAME']), 'host' => $_SERVER['SERVER_NAME'], 'path' => $_SERVER['REQUEST_URI'], 'user' => $_POST['config_username'], 'flickr_comment' => empty($_POST['config_flickr_api_key']) ? ';' : '', 'flickr_key' => $_POST['config_flickr_api_key'], 'google_map_comment' => empty($_POST['config_google_maps_api_key']) ? ';' : '', 'google_map_key' => $_POST['config_google_maps_api_key']);
if (Config::SaveFile($root . '/protected/install/config.ini.template', $root . '/protected/config/config.ini', $substitutions)) {
Check::good('[' . date('H:i:s') . '] Saved config file.');
} else {
$_SESSION['config'] = Config::RenderFile($root . '/protected/install/config.ini.template', $substitutions);
Check::warn("Could not write config.ini.<br/>Please below to download your config file and place it in <tt>protected/config/</tt>.<br/><a href=\"?config\">Download config.ini</a>");
}
print "<p>Installation Complete!</p>";
print "<p>Please remove or rename protected/install/install.php</p>";
print '<p>Go To: <a href="http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] . '/admin">Administration</a> or <a href="http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] . '">Front Page</a></p>';
return 'Installation';
} else {
throw new Exception('Your configuration has errors, please see below.');
}
} catch (Exception $e) {
Check::bad($e->getMessage());
Check::restart();
}
示例2: Exception
// Connect to the database
$res = Database::Connect($config->db->host, $config->db->dbname, $config->db->username, $config->db->password);
if (true !== $res) {
throw new Exception('Error connecting to the database:<br/><div class="nested-error">' . $res . '</div>');
}
// If version = 0, run the initial schema
if ($current_version == 0) {
$res = Database::RunFolder($root . '/protected/install/database/schema/');
if (true !== $res) {
throw new Exception('Error loading database schema:<br/><div class="nested-error">' . $res . '</div>');
}
}
// Run the update scripts
while ($current_version < DATABASE_VERSION) {
$next_version = $current_version + 1;
$folder = sprintf($root . '/protected/install/database/update/%03d/', $next_version);
$res = Database::RunFolder($folder);
if (true !== $res) {
throw new Exception('Error running database upgrade script:<br/><div class="nested-error">' . $res . '</div><p>While processing folder ' . $folder . '</p>');
}
// Save the new version and move to the next one
@file_put_contents($root . '/protected/install/database/version', $next_version);
Check::good("Applied upgrade script to version {$next_version}.");
$current_version++;
}
// Done !
Check::good("Successfully upgraded the database !");
} catch (Exception $e) {
Check::bad($e->getMessage());
}
return "Database upgrade";
示例3: PathWritable
public static function PathWritable($path, $warn_only = false)
{
$root = dirname(__FILE__) . '/../../';
if (is_writable($root . $path)) {
Check::good("{$path} is writable.");
} else {
if ($warn_only) {
Check::warn("{$path} is not writable.");
} else {
Check::bad("{$path} is not writable.");
}
}
}