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


PHP get_db_directories函数代码示例

本文整理汇总了PHP中get_db_directories函数的典型用法代码示例。如果您正苦于以下问题:PHP get_db_directories函数的具体用法?PHP get_db_directories怎么用?PHP get_db_directories使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: invoke

 /**
  * Invoke method, every class will have its own
  * returns true/false on completion, setting both
  * errormsg and output as necessary
  */
 function invoke()
 {
     parent::invoke();
     $result = true;
     /// Set own core attributes
     $this->does_generate = ACTION_NONE;
     //$this->does_generate = ACTION_GENERATE_HTML;
     /// These are always here
     global $CFG, $XMLDB;
     /// Do the job, setting $result as needed
     /// Lets go to add all the db directories available inside Moodle
     /// Create the array if it doesn't exists
     if (!isset($XMLDB->dbdirs)) {
         $XMLDB->dbdirs = array();
     }
     /// get list of all dirs and create objects with status
     $db_direcotries = get_db_directories();
     foreach ($db_direcotries as $path) {
         $dbdir = new stdClass();
         $dbdir->path = $path;
         if (!isset($XMLDB->dbdirs[$dbdir->path])) {
             $XMLDB->dbdirs[$dbdir->path] = $dbdir;
         }
         $XMLDB->dbdirs[$dbdir->path]->path_exists = file_exists($dbdir->path);
         //Update status
     }
     /// Sort by key
     ksort($XMLDB->dbdirs);
     /// Return ok if arrived here
     return true;
 }
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:36,代码来源:get_db_directories.class.php

示例2: invoke

 /**
  * Invoke method, every class will have its own
  * returns true/false on completion, setting both
  * errormsg and output as necessary
  */
 function invoke()
 {
     parent::invoke();
     $result = true;
     /// Set own core attributes
     $this->does_generate = ACTION_GENERATE_HTML;
     /// These are always here
     global $CFG, $XMLDB;
     /// Do the job, setting $result as needed
     /// Add link back to home
     $b = ' <p class="centerpara buttons">';
     $b .= '&nbsp;<a href="index.php?action=main_view#lastused">[' . $this->str['backtomainview'] . ']</a>';
     $b .= '</p>';
     $this->output = $b;
     $c = ' <p class="centerpara">';
     $c .= $this->str['documentationintro'];
     $c .= '</p>';
     $this->output .= $c;
     $this->docs = '';
     if (class_exists('XSLTProcessor')) {
         $doc = new DOMDocument();
         $xsl = new XSLTProcessor();
         $doc->load(dirname(__FILE__) . '/../generate_documentation/xmldb.xsl');
         $xsl->importStyleSheet($doc);
         $dbdirs = get_db_directories();
         sort($dbdirs);
         $index = $this->str['docindex'] . ' ';
         foreach ($dbdirs as $path) {
             if (!file_exists($path . '/install.xml')) {
                 continue;
             }
             $dir = trim(dirname(str_replace($CFG->dirroot, '', $path)), '/');
             $index .= '<a href="#file_' . str_replace('/', '_', $dir) . '">' . $dir . '</a>, ';
             $this->docs .= '<div class="file" id="file_' . str_replace('/', '_', $dir) . '">';
             $this->docs .= '<h2>' . $dir . '</h2>';
             $doc->load($path . '/install.xml');
             $this->docs .= $xsl->transformToXML($doc);
             $this->docs .= '</div>';
         }
         $this->output .= '<div id="file_idex">' . trim($index, ' ,') . '</div>' . $this->docs;
         $this->output .= $b;
     } else {
         $this->output .= get_string('extensionrequired', 'tool_xmldb', 'xsl');
     }
     /// Launch postaction if exists (leave this unmodified)
     if ($this->getPostAction() && $result) {
         return $this->launch($this->getPostAction());
     }
     return $result;
 }
开发者ID:nigeldaley,项目名称:moodle,代码行数:55,代码来源:generate_all_documentation.class.php

示例3: get_used_table_names

/**
 * Returns names of all known tables == tables that moodle knowns about.
 * @return array of lowercase table names
 */
function get_used_table_names()
{
    $table_names = array();
    $dbdirs = get_db_directories();
    foreach ($dbdirs as $dbdir) {
        $file = $dbdir . '/install.xml';
        $xmldb_file = new xmldb_file($file);
        if (!$xmldb_file->fileExists()) {
            continue;
        }
        $loaded = $xmldb_file->loadXMLStructure();
        $structure = $xmldb_file->getStructure();
        if ($loaded and $tables = $structure->getTables()) {
            foreach ($tables as $table) {
                $table_names[] = strtolower($table->name);
            }
        }
    }
    return $table_names;
}
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:24,代码来源:adminlib.php

示例4: get_install_xml_schema

 /**
  * Reads the install.xml files for Moodle core and modules and returns an array of
  * xmldb_structure object with xmldb_table from these files.
  * @return xmldb_structure schema from install.xml files
  */
 public function get_install_xml_schema()
 {
     global $CFG;
     require_once $CFG->libdir . '/adminlib.php';
     $schema = new xmldb_structure('export');
     $schema->setVersion($CFG->version);
     $dbdirs = get_db_directories();
     foreach ($dbdirs as $dbdir) {
         $xmldb_file = new xmldb_file($dbdir . '/install.xml');
         if (!$xmldb_file->fileExists() or !$xmldb_file->loadXMLStructure()) {
             continue;
         }
         $structure = $xmldb_file->getStructure();
         $tables = $structure->getTables();
         foreach ($tables as $table) {
             $table->setPrevious(null);
             $table->setNext(null);
             $schema->addTable($table);
         }
     }
     return $schema;
 }
开发者ID:saurabh947,项目名称:MoodleLearning,代码行数:27,代码来源:database_manager.php


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