/** * deleteFile - Delete a file - locally and remotely if required. * * @param string A filename - NOT fully qualified. * @return boolean **/ function deleteFile($filename) { $full_path = DOCUMENT_ROOT . $filename; if (file_exists($full_path)) { if (unlink($full_path)) { NDebug::debug("{$full_path} was deleted.", N_DEBUGTYPE_INFO); // Delete the file from the mirror server. if (defined('MIRROR_SITE') && MIRROR_SITE) { require_once 'n_mirror.php'; $mirror = NMirror::getInstance(); $mirror->connect(); $mirror->deleteFile($filename); $mirror->disconnect(); unset($mirror); } return true; } else { NDebug::debug("{$full_path} was NOT deleted.", N_DEBUGTYPE_INFO); return false; } } else { NDebug::debug("{$full_path} was not found or already deleted.", N_DEBUGTYPE_INFO); return false; } }
function mirrorImage() { if (defined('MIRROR_SITE') && MIRROR_SITE) { $mirror = NMirror::getInstance(); $mirror->putFile($this->large_image); } }