Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/backup/backup.class.php
Go to the documentation of this file.
00001 <?php
00002 
00003 // This file is part of Moodle - http://moodle.org/
00004 //
00005 // Moodle is free software: you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation, either version 3 of the License, or
00008 // (at your option) any later version.
00009 //
00010 // Moodle is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
00017 
00034 abstract class backup implements checksumable {
00035 
00036     // Backup type
00037     const TYPE_1ACTIVITY = 'activity';
00038     const TYPE_1SECTION  = 'section';
00039     const TYPE_1COURSE   = 'course';
00040 
00041     // Backup format
00042     const FORMAT_MOODLE  = 'moodle2';
00043     const FORMAT_MOODLE1 = 'moodle1';
00044     const FORMAT_IMSCC1  = 'imscc1';
00045     const FORMAT_IMSCC11 = 'imscc11';
00046     const FORMAT_UNKNOWN = 'unknown';
00047 
00048     // Interactive
00049     const INTERACTIVE_YES = true;
00050     const INTERACTIVE_NO  = false;
00051 
00052     // Predefined modes (purposes) of the backup
00053     const MODE_GENERAL   = 10;
00054     const MODE_IMPORT    = 20;
00055     const MODE_HUB       = 30;
00056     const MODE_SAMESITE  = 40;
00057     const MODE_AUTOMATED = 50;
00058     const MODE_CONVERTED = 60;
00059 
00060     // Target (new/existing/current/adding/deleting)
00061     const TARGET_CURRENT_DELETING = 0;
00062     const TARGET_CURRENT_ADDING   = 1;
00063     const TARGET_NEW_COURSE       = 2;
00064     const TARGET_EXISTING_DELETING= 3;
00065     const TARGET_EXISTING_ADDING  = 4;
00066 
00067     // Execution mode
00068     const EXECUTION_INMEDIATE = 1;
00069     const EXECUTION_DELAYED   = 2;
00070 
00071     // Status of the backup_controller
00072     const STATUS_CREATED     = 100;
00073     const STATUS_REQUIRE_CONV= 200;
00074     const STATUS_PLANNED     = 300;
00075     const STATUS_CONFIGURED  = 400;
00076     const STATUS_SETTING_UI  = 500;
00077     const STATUS_NEED_PRECHECK=600;
00078     const STATUS_AWAITING    = 700;
00079     const STATUS_EXECUTING   = 800;
00080     const STATUS_FINISHED_ERR= 900;
00081     const STATUS_FINISHED_OK =1000;
00082 
00083     // Logging levels
00084     const LOG_DEBUG   = 50;
00085     const LOG_INFO    = 40;
00086     const LOG_WARNING = 30;
00087     const LOG_ERROR   = 20;
00088     const LOG_NONE    = 10;
00089 
00090     // Some constants used to identify some helpfull processor variables
00091     // (using negative numbers to avoid any collision posibility
00092     // To be used when defining backup structures
00093     const VAR_COURSEID   = -1;  // To reference id of course in a processor
00094     const VAR_SECTIONID  = -11; // To reference id of section in a processor
00095     const VAR_ACTIVITYID = -21; // To reference id of activity in a processor
00096     const VAR_MODID      = -31; // To reference id of course_module in a processor
00097     const VAR_MODNAME    = -41; // To reference name of module in a processor
00098     const VAR_BLOCKID    = -51; // To reference id of block in a processor
00099     const VAR_BLOCKNAME  = -61; // To reference name of block in a processor
00100     const VAR_CONTEXTID  = -71; // To reference context id in a processor
00101     const VAR_PARENTID   = -81; // To reference the first parent->id in a backup structure
00102 
00103     // Used internally by the backup process
00104     const VAR_BACKUPID   = -1001; // To reference the backupid being processed
00105     const VAR_BASEPATH   = -1011; // To reference the dir where the file is generated
00106 
00107     // Type of operation
00108     const OPERATION_BACKUP  ='backup'; // We are performing one backup
00109     const OPERATION_RESTORE ='restore';// We are performing one restore
00110 
00111     // Version (to keep CFG->backup_version (and release) updated automatically)
00112     const VERSION = 2011063000;
00113     const RELEASE = '2.1';
00114 }
00115 
00116 /*
00117  * Exception class used by all the @backup stuff
00118  */
00119 abstract class backup_exception extends moodle_exception {
00120 
00121     public function __construct($errorcode, $a=NULL, $debuginfo=null) {
00122         parent::__construct($errorcode, 'error', '', $a, $debuginfo);
00123     }
00124 }
 All Data Structures Namespaces Files Functions Variables Enumerations