当前位置: 首页>>代码示例>>PHP>>正文


PHP BigTree::setDirectoryPermissions方法代码示例

本文整理汇总了PHP中BigTree::setDirectoryPermissions方法的典型用法代码示例。如果您正苦于以下问题:PHP BigTree::setDirectoryPermissions方法的具体用法?PHP BigTree::setDirectoryPermissions怎么用?PHP BigTree::setDirectoryPermissions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BigTree的用法示例。


在下文中一共展示了BigTree::setDirectoryPermissions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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;
 }
开发者ID:kurt-planet,项目名称:BigTree-CMS,代码行数:101,代码来源:admin.php


注:本文中的BigTree::setDirectoryPermissions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。