| [ Index ] |
PHP Cross Reference of Moodle 1.9.3 [Build 15-Oct-2008] |
[Summary view] [Print] [Text view]
1 <?php // $Id: get_db_directories.class.php,v 1.8.2.3 2008/01/03 15:03:00 skodak Exp $ 2 3 /////////////////////////////////////////////////////////////////////////// 4 // // 5 // NOTICE OF COPYRIGHT // 6 // // 7 // Moodle - Modular Object-Oriented Dynamic Learning Environment // 8 // http://moodle.com // 9 // // 10 // Copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com // 11 // (C) 2001-3001 Eloy Lafuente (stronk7) http://contiento.com // 12 // // 13 // This program is free software; you can redistribute it and/or modify // 14 // it under the terms of the GNU General Public License as published by // 15 // the Free Software Foundation; either version 2 of the License, or // 16 // (at your option) any later version. // 17 // // 18 // This program is distributed in the hope that it will be useful, // 19 // but WITHOUT ANY WARRANTY; without even the implied warranty of // 20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // 21 // GNU General Public License for more details: // 22 // // 23 // http://www.gnu.org/copyleft/gpl.html // 24 // // 25 /////////////////////////////////////////////////////////////////////////// 26 27 /// This class will check all the db directories existing under the 28 /// current Moodle installation, sending them to the SESSION->dbdirs array 29 30 class get_db_directories extends XMLDBAction { 31 32 /** 33 * Init method, every subclass will have its own 34 */ 35 function init() { 36 parent::init(); 37 /// Set own core attributes 38 $this->can_subaction = ACTION_NONE; 39 //$this->can_subaction = ACTION_HAVE_SUBACTIONS; 40 41 /// Set own custom attributes 42 43 /// Get needed strings 44 $this->loadStrings(array( 45 /// 'key' => 'module', 46 )); 47 } 48 49 /** 50 * Invoke method, every class will have its own 51 * returns true/false on completion, setting both 52 * errormsg and output as necessary 53 */ 54 function invoke() { 55 parent::invoke(); 56 57 $result = true; 58 59 /// Set own core attributes 60 $this->does_generate = ACTION_NONE; 61 //$this->does_generate = ACTION_GENERATE_HTML; 62 63 /// These are always here 64 global $CFG, $XMLDB; 65 66 /// Do the job, setting $result as needed 67 68 /// Lets go to add all the db directories available inside Moodle 69 /// Create the array if it doesn't exists 70 if (!isset($XMLDB->dbdirs)) { 71 $XMLDB->dbdirs = array(); 72 } 73 74 /// get list of all dirs and create objects with status 75 $db_direcotries = get_db_directories(); 76 foreach ($db_direcotries as $path) { 77 $dbdir = new stdClass; 78 $dbdir->path = $path; 79 if (!isset($XMLDB->dbdirs[$dbdir->path])) { 80 $XMLDB->dbdirs[$dbdir->path] = $dbdir; 81 } 82 $XMLDB->dbdirs[$dbdir->path]->path_exists = file_exists($dbdir->path); //Update status 83 } 84 85 /// Sort by key 86 ksort($XMLDB->dbdirs); 87 88 /// Return ok if arrived here 89 return true; 90 } 91 } 92 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Jan 14 11:33:29 2009 | Cross-referenced by PHPXref 0.7 |