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


PHP FreePBX::Less方法代码示例

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


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

示例1: install


//.........这里部分代码省略.........
     if (!$force) {
         if (!in_array($modules[$modulename]['status'], array(MODULE_STATUS_ENABLED, MODULE_STATUS_NOTINSTALLED, MODULE_STATUS_NEEDUPGRADE))) {
             //return array(_("This module is already installed."));
             // This isn't really an error, we just exit
             return true;
         }
         // check dependencies
         if (is_array($errors = $this->checkdepends($modules[$modulename]))) {
             return $errors;
         }
     }
     // Check if another module wants this install to be rejected
     // The module must have a callback: [modulename]_module_install_check_callback() that takes
     // a single modules array from module_getinfo() about the module to be installed
     // and it must pass back boolean true if the installation can proceed, or a message
     // indicating why the installation must fail
     //
     $rejects = array();
     //We need to include developer files before the callback happens during an install
     if (!$this->_runscripts_include($modules, 'install')) {
         return array(_("Failed to run installation scripts"));
     }
     foreach (mod_func_iterator('module_install_check_callback', $modules) as $mod => $res) {
         if ($res !== true) {
             $rejects[] = $res;
         }
     }
     if (!empty($rejects)) {
         return $rejects;
     }
     //Developer mode, remind them they need to run install_amp manually
     //run this before the install scripts below because they end up removing install.php...yup
     if ($modulename == 'framework' && !file_exists($dir . '/install.php')) {
         out(_("Framework has been detected as being in Developer mode, Please make sure to run './install_amp --update-links' manually so that any database or system settings can be updated"));
     }
     // run the scripts
     if (!$this->_runscripts($modulename, 'install', $modules)) {
         return array(_("Failed to run installation scripts"));
     }
     if ($modules[$modulename]['status'] == MODULE_STATUS_NOTINSTALLED) {
         // customize INSERT query
         $sql = "INSERT INTO modules (modulename, version, enabled) values ('" . $db->escapeSimple($modules[$modulename]['rawname']) . "','" . $db->escapeSimple($modules[$modulename]['version']) . "', 1);";
     } else {
         // just need to update the version
         $sql = "UPDATE modules SET version='" . $db->escapeSimple($modules[$modulename]['version']) . "' WHERE modulename = '" . $db->escapeSimple($modules[$modulename]['rawname']) . "'";
     }
     // run query
     $results = $db->query($sql);
     if (DB::IsError($results)) {
         return array(sprintf(_("Error updating database. Command was: %s; error was: %s "), $sql, $results->getMessage()));
     }
     // If module is framework then update the framework version
     // normally this is done inside of the funky upgrade script runner but we are changing this now as
     // framework and freepbx versions are the same
     if ($modulename == 'framework' && !empty($modules[$modulename]['version']) && getVersion() != $modules[$modulename]['version']) {
         out(sprintf(_("Framework Detected, Setting FreePBX Version to %s"), $modules[$modulename]['version']));
         $sql = "UPDATE admin SET value = '" . $db->escapeSimple($modules[$modulename]['version']) . "' WHERE variable = 'version'";
         $result = $db->query($sql);
         if (DB::IsError($result)) {
             die($result->getMessage());
         }
         if (getVersion() != $modules[$modulename]['version']) {
             die(_('Internal Error. Function getVersion did not match the Framework version, even after it was suppose to be applied'));
         }
     }
     // module is now installed & enabled, invalidate the modulelist class since it is now stale
     $modulelist =& modulelist::create($db);
     $modulelist->invalidate();
     // edit the notification table to list any remaining upgrades available or clear
     // it if none are left. It requres a copy of the most recent module_xml to compare
     // against the installed modules.
     //
     $sql = 'SELECT data FROM module_xml WHERE id = "xml"';
     $data = sql($sql, "getOne");
     $parser = new xml2ModuleArray($data);
     $xmlarray = $parser->parseAdvanced($data);
     $new_modules = array();
     if (count($xmlarray)) {
         foreach ($xmlarray['xml']['module'] as $mod) {
             $new_modules[$mod['rawname']] = $mod;
         }
     }
     $this->upgrade_notifications($new_modules, 'PASSIVE');
     needreload();
     FreePBX::Config()->update("SIGNATURECHECK", true);
     $db->query("DELETE FROM admin WHERE variable = 'unsigned' LIMIT 1");
     //Generate LESS on install
     //http://issues.freepbx.org/browse/FREEPBX-8287
     outn(_("Generating CSS..."));
     try {
         if ($modulename == 'framework') {
             FreePBX::Less()->generateMainStyles();
         } else {
             FreePBX::Less()->generateModuleStyles($modulename);
         }
     } catch (\Exception $e) {
     }
     out(_("Done"));
     return true;
 }
开发者ID:ntadmin,项目名称:framework,代码行数:101,代码来源:modulefunctions.class.php


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