/** * Writes a variable to the database (#__jp_packvars) * * @param string $varName The name of the variable (must be unique; if it exists it gets overwritten) * @param string $value The value to store * @param bool $boolLongText True if you want to store a large string; deprecated since 1.1.2b * @static */ function WriteVar($varName, $value, $boolLongText = false) { $database = JoomlapackAbstraction::getDatabase(); // Hopefully fixes the 'MySQL server has gone away' errors by testing MySQL // connection status and reconnecting if necessary. if (method_exists($database, 'connected')) { $database->connected(); } // Kill exisiting variable (if any) JoomlapackTables::DeleteVar($varName); // Create variable $sql = "INSERT INTO #__jp_packvars (`key`, value2) VALUES (" . $database->Quote($varName) . ", " . $database->Quote($value) . ")"; $database->setQuery($sql); if ($database->query() === false) { JoomlapackLogger::WriteLog(_JP_LOG_ERROR, 'Failed to store packing variable ' . $varName . ' in database.'); JoomlapackLogger::WriteLog(_JP_LOG_ERROR, 'Error Message: ' . $database->getErrorMsg()); JoomlapackLogger::WriteLog(_JP_LOG_ERROR, 'Value was ' . $value); return false; } return true; }
function deleteTempFiles() { $configuration =& JoomlapackConfiguration::getInstance(); $tempFiles = JoomlapackTables::UnserializeVar('CUBETempFiles', array()); foreach ($tempFiles as $fileName) { $file = $configuration->get('TempDirectory') . DS . $fileName; if (file_exists($file)) { @unlink($file); } } JoomlapackTables::DeleteVar('CUBETempFiles'); }