Joomla / PHP başlıca bellek sızıntısı .. Ne verir?

0 Cevap php
 }
public function backup(){
    $app =& JFactory::getApplication();
    $createTablesSQL = $this->_dbo->getTableCreate($this->_tables);
    $databaseName = $app->getCfg("db");
    $data = "--\n-- Database: `{$databaseName}`\n--\n\n";
    foreach ($createTablesSQL as $key => $value){
        $data .= "DROP TABLE IF EXISTS `{$key}`;\n";
        $data .= "\n--\n-- Table structure for table `{$key}`\n--\n";
        $data .= $value . ";\n";
        $tableFields = $this->_dbo->getTableFields($key);
        $this->_dbo->setQuery("SELECT * FROM `{$key}`");
        $this->_dbo->query();
        if($this->_dbo->getNumRows()){
            $data .= "--\n-- Dumping data for table `{$key}`\n--\n";
            $data .= "LOCK TABLES `{$key}` WRITE;\n";
            $fields = array_keys($tableFields);
            $data .= "REPLACE INTO `{$key}` (`".implode("`, `", array_keys($tableFields[$fields[0]]))."`) VALUES \n";
            // Load data from table
            $rows = $this->_dbo->loadRowList();
            $_ = array();
            foreach ($rows as $row){
                foreach ($row as $k => $v){
                    if(!isset($v))
                        $row[$k] = 'NULL';
                    else
                        $row[$k] = "'".addslashes($v)."'";
                    }
                $_[] = "\t(".implode(", ", $row).")";
            }
            $data .= implode(",\n", $_);
            $data .= ";\nUNLOCK TABLES;\n\n";
        }
    }
    // fix dbprefix after getTableCreate
    $tablePrefix = $app->getCfg("dbprefix");
    $data = str_replace($tablePrefix, "#__", $data);
    // write backup file
    $path2Filename = $this->path2BackupFiles;
    $filename = $this->filePrefix . date("Y_m_d_H_i_s", time()) . "_" . CompanyUpdate::getCurrentVersion() . ".sql";
    if(JFile::write($path2Filename . $filename, $data)){
        // compression
        if(false != ($arFile = $this->compressFile($path2Filename, $filename, 'zip', true))){
            return $arFile;
        }else{
            return false;
        }
    }else{
        return false;    
    }
}
/**
 *
 * @param string $path2Filename
 * @param string $filename
 * @param string $type
 * @param bool $cleanUp
 * @return bool
 */
private function compressFile($path2Filename, $filename, $type = 'zip', $cleanUp = false){
    $fullPathFilename = $path2Filename . $filename;     
    $adapter =& JArchive::getAdapter($type); // type compression
    $files2ZIP = array();
    $files2ZIP[0]["name"] = $filename;
    $files2ZIP[0]["data"] = JFile::read($fullPathFilename);
    if($adapter->create($fullPathFilename . "." . $type, $files2ZIP, $type, $path2Filename)){
        if($cleanUp)
            JFile::delete($fullPathFilename);
        return JFile::stripExt($filename) . "." . $type;
    }else{
        return false;
    }
}

} ?>

Herkes burada bir yerde bir sızıntı görmek?

EDIT: hata sonrası düşünmüş olmalı. Üzgünüm

Ölümcül hata: Out of memory (65536000 ayrılan) (125459 bayt ayırmaya çalıştı) / home/user2/public_html/administrator/components/com_company/lib/CompanyBaseDManagement.php line 395

$ Row [$ k] = "'".. Addslashes ($ v) "'";: Dreamweaver göre bu hat 395 olduğunu

0 Cevap