本文整理汇总了PHP中BigTree::deleteDirectory方法的典型用法代码示例。如果您正苦于以下问题:PHP BigTree::deleteDirectory方法的具体用法?PHP BigTree::deleteDirectory怎么用?PHP BigTree::deleteDirectory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BigTree
的用法示例。
在下文中一共展示了BigTree::deleteDirectory方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cleanup
function cleanup()
{
if (file_exists(SERVER_ROOT . "cache/update/")) {
BigTree::deleteDirectory(SERVER_ROOT . "cache/update/");
}
@unlink(SERVER_ROOT . "cache/update.zip");
}
示例2: installExtension
//.........这里部分代码省略.........
foreach ($module["embed_forms"] as $form) {
$this->createModuleEmbedForm($module_id, $form["title"], $form["table"], is_array($form["fields"]) ? $form["fields"] : json_decode($form["fields"], true), $form["hooks"], $form["default_position"], $form["default_pending"], $form["css"], $form["redirect_url"], $form["thank_you_message"]);
}
// Create views
foreach ($module["views"] as $view) {
$bigtree["view_id_match"][$view["id"]] = $this->createModuleView($module_id, $view["title"], $view["description"], $view["table"], $view["type"], is_array($view["options"]) ? $view["options"] : json_decode($view["options"], true), is_array($view["fields"]) ? $view["fields"] : json_decode($view["fields"], true), is_array($view["actions"]) ? $view["actions"] : json_decode($view["actions"], true), $view["suffix"], $view["preview_url"]);
}
// Create regular forms
foreach ($module["forms"] as $form) {
$bigtree["form_id_match"][$form["id"]] = $this->createModuleForm($module_id, $form["title"], $form["table"], is_array($form["fields"]) ? $form["fields"] : json_decode($form["fields"], true), $form["hooks"], $form["default_position"], $form["return_view"] ? $bigtree["view_id_match"][$form["return_view"]] : false, $form["return_url"], $form["tagging"]);
}
// Create reports
foreach ($module["reports"] as $report) {
$bigtree["report_id_match"][$report["id"]] = $this->createModuleReport($module_id, $report["title"], $report["table"], $report["type"], is_array($report["filters"]) ? $report["filters"] : json_decode($report["filters"], true), is_array($report["fields"]) ? $report["fields"] : json_decode($report["fields"], true), $report["parser"], $report["view"] ? $bigtree["view_id_match"][$report["view"]] : false);
}
// Create actions
foreach ($module["actions"] as $action) {
$this->createModuleAction($module_id, $action["name"], $action["route"], $action["in_nav"], $action["class"], $bigtree["form_id_match"][$action["form"]], $bigtree["view_id_match"][$action["view"]], $bigtree["report_id_match"][$action["report"]], $action["level"], $action["position"]);
}
}
}
// Import templates
foreach ($manifest["components"]["templates"] as $template) {
if ($template) {
$resources = sqlescape(is_array($template["resources"]) ? BigTree::json($template["resources"]) : $template["resources"]);
sqlquery("INSERT INTO bigtree_templates (`id`,`name`,`module`,`resources`,`level`,`routed`,`extension`) VALUES ('" . sqlescape($template["id"]) . "','" . sqlescape($template["name"]) . "','" . $bigtree["module_match"][$template["module"]] . "','{$resources}','" . sqlescape($template["level"]) . "','" . sqlescape($template["routed"]) . "','{$extension}')");
}
}
// Import callouts
foreach ($manifest["components"]["callouts"] as $callout) {
if ($callout) {
$resources = sqlescape(is_array($callout["resources"]) ? BigTree::json($callout["resources"]) : $callout["resources"]);
sqlquery("INSERT INTO bigtree_callouts (`id`,`name`,`description`,`display_default`,`display_field`,`resources`,`level`,`position`,`extension`) VALUES ('" . sqlescape($callout["id"]) . "','" . sqlescape($callout["name"]) . "','" . sqlescape($callout["description"]) . "','" . sqlescape($callout["display_default"]) . "','" . sqlescape($callout["display_field"]) . "','{$resources}','" . sqlescape($callout["level"]) . "','" . sqlescape($callout["position"]) . "','{$extension}')");
}
}
// Import Settings
foreach ($manifest["components"]["settings"] as $setting) {
if ($setting) {
$this->createSetting($setting);
sqlquery("UPDATE bigtree_settings SET extension = '{$extension}' WHERE id = '" . sqlescape($setting["id"]) . "'");
}
}
// Import Feeds
foreach ($manifest["components"]["feeds"] as $feed) {
if ($feed) {
$fields = sqlescape(is_array($feed["fields"]) ? BigTree::json($feed["fields"]) : $feed["fields"]);
$options = sqlescape(is_array($feed["options"]) ? BigTree::json($feed["options"]) : $feed["options"]);
sqlquery("INSERT INTO bigtree_feeds (`route`,`name`,`description`,`type`,`table`,`fields`,`options`,`extension`) VALUES ('" . sqlescape($feed["route"]) . "','" . sqlescape($feed["name"]) . "','" . sqlescape($feed["description"]) . "','" . sqlescape($feed["type"]) . "','" . sqlescape($feed["table"]) . "','{$fields}','{$options}','{$extension}')");
}
}
// Import Field Types
foreach ($manifest["components"]["field_types"] as $type) {
if ($type) {
$self_draw = $type["self_draw"] ? "'on'" : "NULL";
$use_cases = sqlescape(is_array($type["use_cases"]) ? json_encode($type["use_cases"]) : $type["use_cases"]);
sqlquery("INSERT INTO bigtree_field_types (`id`,`name`,`use_cases`,`self_draw`,`extension`) VALUES ('" . sqlescape($type["id"]) . "','" . sqlescape($type["name"]) . "','{$use_cases}',{$self_draw},'{$extension}')");
}
}
// Upgrades don't drop tables, we run the SQL revisions instead
if (is_array($upgrade)) {
$old_revision = $upgrade["revision"];
$sql_revisions = $manifest["sql_revisions"];
// Go through all the SQL updates, we ksort first to ensure if the manifest somehow got out of order that we run the SQL update sequentially
ksort($sql_revisions);
foreach ($sql_revisions as $key => $statements) {
if ($key > $old_revision) {
foreach ($statements as $sql_statement) {
sqlquery($sql_statement);
}
}
}
// Update the extension
sqlquery("UPDATE bigtree_extensions SET name = '" . sqlescape($manifest["title"]) . "', version = '" . sqlescape($manifest["version"]) . "', last_updated = NOW(), manifest = '" . BigTree::json($manifest, true) . "' WHERE id = '" . sqlescape($manifest["id"]) . "'");
// Straight installs move files into place locally
} else {
// Make sure destination doesn't exist
$destination_path = SERVER_ROOT . "extensions/" . $manifest["id"] . "/";
BigTree::deleteDirectory($destination_path);
// Move the package to the extension directory
rename(SERVER_ROOT . "cache/package/", $destination_path);
BigTree::setDirectoryPermissions($destination_path);
// Create the extension
sqlquery("INSERT INTO bigtree_extensions (`id`,`type`,`name`,`version`,`last_updated`,`manifest`) VALUES ('" . sqlescape($manifest["id"]) . "','extension','" . sqlescape($manifest["title"]) . "','" . sqlescape($manifest["version"]) . "',NOW(),'" . BigTree::json($manifest, true) . "')");
}
// Re-enable foreign key checks
sqlquery("SET foreign_key_checks = 1");
// Empty view cache
sqlquery("DELETE FROM bigtree_module_view_cache");
// Move public files into the site directory
$public_dir = SERVER_ROOT . "extensions/" . $manifest["id"] . "/public/";
$site_contents = file_exists($public_dir) ? BigTree::directoryContents($public_dir) : array();
foreach ($site_contents as $file_path) {
$destination_path = str_replace($public_dir, SITE_ROOT . "extensions/" . $manifest["id"] . "/", $file_path);
BigTree::copyFile($file_path, $destination_path);
}
// Clear module class cache and field type cache.
@unlink(SERVER_ROOT . "cache/bigtree-module-class-list.json");
@unlink(SERVER_ROOT . "cache/bigtree-form-field-types.json");
return $manifest;
}
示例3: sqlquery
sqlquery("INSERT INTO bigtree_feeds (`route`,`name`,`description`,`type`,`table`,`fields`,`options`) VALUES ('" . sqlescape($feed["route"]) . "','" . sqlescape($feed["name"]) . "','" . sqlescape($feed["description"]) . "','" . sqlescape($feed["type"]) . "','" . sqlescape($feed["table"]) . "','{$fields}','{$options}')");
}
}
// Import Field Types
foreach ($json["components"]["field_types"] as $type) {
if ($type) {
sqlquery("DELETE FROM bigtree_field_types WHERE id = '" . sqlescape($type["id"]) . "'");
// Backwards compatibility with field types packaged for 4.1
if (!isset($type["use_cases"])) {
$type["use_cases"] = array("templates" => $type["pages"], "modules" => $type["modules"], "callouts" => $type["callouts"], "settings" => $type["settings"]);
}
$use_cases = is_array($type["use_cases"]) ? sqlescape(json_encode($type["use_cases"])) : sqlescape($type["use_cases"]);
$self_draw = $type["self_draw"] ? "'on'" : "NULL";
sqlquery("INSERT INTO bigtree_field_types (`id`,`name`,`use_cases`,`self_draw`) VALUES ('" . sqlescape($type["id"]) . "','" . sqlescape($type["name"]) . "','{$use_cases}',{$self_draw})");
}
}
// Import files
foreach ($json["files"] as $file) {
BigTree::copyFile(SERVER_ROOT . "cache/package/{$file}", SERVER_ROOT . $file);
}
// Empty view cache
sqlquery("DELETE FROM bigtree_module_view_cache");
// Remove the package directory
BigTree::deleteDirectory(SERVER_ROOT . "cache/package/");
// Clear module class cache and field type cache.
@unlink(SERVER_ROOT . "cache/bigtree-module-class-list.json");
@unlink(SERVER_ROOT . "cache/bigtree-form-field-types.json");
sqlquery("INSERT INTO bigtree_extensions (`id`,`type`,`name`,`version`,`last_updated`,`manifest`) VALUES ('" . sqlescape($json["id"]) . "','package','" . sqlescape($json["title"]) . "','" . sqlescape($json["version"]) . "',NOW(),'" . BigTree::json($json, true) . "')");
sqlquery("SET foreign_key_checks = 1");
$admin->growl("Developer", "Installed Package");
BigTree::redirect(DEVELOPER_ROOT . "packages/install/complete/");
示例4: PclZip
BigTree::deleteDirectory($cache_root);
BigTree::makeDirectory($cache_root);
// Unzip the package
include BigTree::path("inc/lib/pclzip.php");
$zip = new PclZip($file);
$files = $zip->extract(PCLZIP_OPT_PATH, $cache_root);
if (!$files) {
BigTree::deleteDirectory($cache_root);
$_SESSION["upload_error"] = "The zip file uploaded was corrupt.";
BigTree::redirect(DEVELOPER_ROOT . "packages/install/");
}
// Read the manifest
$json = json_decode(file_get_contents($cache_root . "manifest.json"), true);
// Make sure it's legit
if ($json["type"] != "package" || !isset($json["id"]) || !isset($json["title"])) {
BigTree::deleteDirectory($cache_root);
$_SESSION["upload_error"] = "The zip file uploaded does not appear to be a BigTree package.";
BigTree::redirect(DEVELOPER_ROOT . "packages/install/");
}
// Check for template collisions
foreach ((array) $json["components"]["templates"] as $template) {
if (sqlrows(sqlquery("SELECT * FROM bigtree_templates WHERE id = '" . sqlescape($template["id"]) . "'"))) {
$warnings[] = "A template already exists with the id “" . $template["id"] . "” — the template will be overwritten.";
}
}
// Check for callout collisions
foreach ((array) $json["components"]["callouts"] as $callout) {
if (sqlrows(sqlquery("SELECT * FROM bigtree_callouts WHERE id = '" . sqlescape($callout["id"]) . "'"))) {
$warnings[] = "A callout already exists with the id “" . $callout["id"] . "” — the callout will be overwritten.";
}
}