Ejemplo n.º 1
0
 /**
  * @param string $pref
  * @return bool
  */
 function CreateTables($pref)
 {
     $tableArray = GetTablesArray($pref);
     $original = GetTablesArray('');
     foreach ($tableArray as $key => $tname) {
         $sql = trim(DB::CreateTable($original[$key], $pref));
         if (!$sql || $sql == '') {
             return false;
         }
         if (!DB::execute($sql)) {
             return $tname;
         }
     }
     return true;
 }
Ejemplo n.º 2
0
$BackupIsGood = true;
if ($db->_settings->DbType != AP_DB_MYSQL) {
    exit('Warning: Incorrect database type.	Tables can be backaped in MySql database only!');
}
if (!$db->Connect()) {
    exit('Connect Error: ' . ap_Utils::TakePhrase('WM_INFO_CONNECTUNSUCCESSFUL') . ' ' . $db->GetError());
}
if (!@is_dir(AP_DATA_FOLDER . '/backup')) {
    @mkdir(AP_DATA_FOLDER . '/backup', 0777);
}
$fp = @fopen(BACKUPFILENAME, 'wb');
if (!$fp) {
    exit('Error: Can\'t open file ' . BACKUPFILENAME);
}
echo '<font color="black" size="3" style="font-family: Tahoma, Verdana;"><h3>WebMail Lite PHP Backup Script:</h3>';
$AllTables = GetTablesArray('');
$tables = array();
for ($t = 0; $t < count($AllTables); $t++) {
    $name = $AllTables[$t];
    if ($name !== DBTABLE_AWM_MESSAGES_INDEX && $name !== DBTABLE_AWM_MESSAGES_BODY_INDEX) {
        $tables[] = $db->_settings->DbPrefix . $AllTables[$t];
    }
}
$dbConnector =& $db->GetConnector();
$mysql_server_info = @mysql_get_server_info();
$TypeEngineKey = version_compare($mysql_server_info, '4.0.0', '>=') ? 'Engine' : 'Type';
// MySQL 4.and higher, the 'Type' of database is now 'Engine' <thanks Philippe Soussan>
$alltablesstructure = '';
for ($t = 0; $t < count($tables); $t++) {
    $fieldnames = array();
    $structurelines = array();
Ejemplo n.º 3
0
 /**
  * @param string $pref
  * @return bool
  */
 function CreateTables($pref)
 {
     $tableArray = GetTablesArray($pref);
     $original = GetTablesArray('');
     foreach ($tableArray as $key => $tname) {
         $sql = trim($this->_commandCreator->CreateTable($original[$key], $pref));
         if (!$sql || $sql == '') {
             return false;
         }
         if (!$this->_dbConnection->Execute($sql)) {
             return $tname;
         }
     }
     return true;
 }