Example #1
0
 function delDir($dirName, $orig = false)
 {
     if (!$orig) {
         $orig = $dirName;
     }
     if (empty($dirName)) {
         return true;
     }
     if (file_exists($dirName)) {
         $dir = dir($dirName);
         while ($file = $dir->read()) {
             if ($file != '.' && $file != '..') {
                 if (is_dir($dirName . '/' . $file)) {
                     PommoHelperMaintenance::delDir($dirName . '/' . $file, $orig);
                 } else {
                     unlink($dirName . '/' . $file) or die('File ' . $dirName . '/' . $file . ' couldn\'t be deleted!');
                 }
             }
         }
         $dir->close();
         if ($dirName != $orig) {
             @rmdir($dirName) or die('Folder ' . $dirName . ' couldn\'t be deleted!');
         }
     } else {
         return false;
     }
     return true;
 }
<?php

/**
 * Copyright (C) 2005, 2006, 2007, 2008  Brice Burgess <*****@*****.**>
 * 
 * This file is part of poMMo (http://www.pommo.org)
 * 
 * poMMo is free software; you can redistribute it and/or modify 
 * it under the terms of the GNU General Public License as published 
 * by the Free Software Foundation; either version 2, or any later version.
 * 
 * poMMo is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty
 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
 * the GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with program; see the file docs/LICENSE. If not, write to the
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 */
/**********************************
	INITIALIZATION METHODS
 *********************************/
define('_poMMo_support', TRUE);
require '../../bootstrap.php';
$pommo->init();
Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/maintenance.php');
echo PommoHelperMaintenance::delDir($pommo->_workDir) ? 'Work Directory Cleared' : 'Unable to Clear Work Directory -- Does it exist?';
<?php

/**
 * Copyright (C) 2005, 2006, 2007, 2008  Brice Burgess <*****@*****.**>
 * 
 * This file is part of poMMo (http://www.pommo.org)
 * 
 * poMMo is free software; you can redistribute it and/or modify 
 * it under the terms of the GNU General Public License as published 
 * by the Free Software Foundation; either version 2, or any later version.
 * 
 * poMMo is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty
 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
 * the GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with program; see the file docs/LICENSE. If not, write to the
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 */
/**********************************
	INITIALIZATION METHODS
 *********************************/
define('_poMMo_support', TRUE);
require '../../bootstrap.php';
$pommo->init();
Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/maintenance.php');
echo PommoHelperMaintenance::delDir($pommo->_workDir) ? 'Le r&eacute;pertoire de travail est vide.' : 'Impossible de vider le r&eacute;pertoire de travail -- A-t-il d&eacute;j&agrave; &eacute;t&eacute; cr&eacute;&eacute;?';
Example #4
0
    $logger->addErr(sprintf(Pommo::_T('To upgrade poMMo, %s click here %s'), '<a href="' . $pommo->_baseUrl . 'install/upgrade.php?continue=TRUE">', '</a>'));
} else {
    $smarty->assign('attempt', TRUE);
    if (isset($_REQUEST['debugInstall'])) {
        $dbo->debug(TRUE);
    }
    if (isset($_REQUEST['forceUpgrade'])) {
        $GLOBALS['pommoFakeUpgrade'] = true;
    }
    if (PommoUpgrade()) {
        $logger->addErr(Pommo::_T('Upgrade Complete!'));
        // Read in RELEASE Notes -- TODO -> use file_get_contents() one day when everyone has PHP 4.3
        $filename = $pommo->_baseDir . 'docs/RELEASE';
        $handle = fopen($filename, "r");
        $x = fread($handle, filesize($filename));
        fclose($handle);
        $smarty->assign('notes', $x);
        $smarty->assign('upgraded', TRUE);
    } else {
        $logger->addErr(Pommo::_T('Upgrade Failed!'));
    }
    // clear the working directory template files
    $smarty->display('upgrade.tpl');
    Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/maintenance.php');
    if (!PommoHelperMaintenance::delDir($pommo->_workDir . '/pommo/smarty')) {
        $logger->addErr('Unable to Clear Working Directory (non fatal)');
    }
    Pommo::kill();
}
$smarty->display('upgrade.tpl');
Pommo::kill();