Example #1
0
#!/usr/bin/env php
<?php 
// +----------------------------------------------------------------------+
// | Automne (TM)														  |
// +----------------------------------------------------------------------+
// | Copyright (c) 2000-2010 WS Interactive								  |
// +----------------------------------------------------------------------+
// | Automne is subject to version 2.0 or above of the GPL license.		  |
// | The license text is bundled with this package in the file			  |
// | LICENSE-GPL, and is available through the world-wide-web at		  |
// | http://www.gnu.org/copyleft/gpl.html.								  |
// +----------------------------------------------------------------------+
// | Author: Antoine Pouch <*****@*****.**>              |
// +----------------------------------------------------------------------+
/**
 * background script : regenerateall
 *
 * Regenerates All the pages : call the function in CMS_tree and lauch regenerator
 *
 * @package Automne
 * @subpackage scripts
 * @author Antoine Pouch <*****@*****.**>
 */
//must calculate the document root first (for compatibility with old scripts)
$_SERVER["DOCUMENT_ROOT"] = realpath(substr(dirname(__FILE__), 0, strlen(dirname(__FILE__)) - strpos(strrev(dirname(__FILE__)), "enmotua") - strlen("automne") - 1));
//include required file
require_once dirname(__FILE__) . '/../../../cms_rc_admin.php';
CMS_tree::regenerateAllPages(true);
Example #2
0
 /**
  * Totally destroys the website, including its directory
  * After deletion from database, launch a regen of the whole tree.
  *
  * @return void
  * @access public
  */
 function destroy()
 {
     if ($this->_id) {
         $sql = "\n\t\t\t\tdelete\n\t\t\t\tfrom\n\t\t\t\t\twebsites\n\t\t\t\twhere\n\t\t\t\t\tid_web='" . $this->_id . "'\n\t\t\t";
         $q = new CMS_query($sql);
         //deletes the pages directory (with all the pages inside)
         if (!$this->_isMain) {
             $dir = $this->getPagesPath(PATH_RELATIVETO_FILESYSTEM);
             if ($opendir = @opendir($dir)) {
                 while (false !== ($readdir = readdir($opendir))) {
                     if ($readdir !== '..' && $readdir !== '.') {
                         $readdir = trim($readdir);
                         if (is_file($dir . '/' . $readdir)) {
                             @unlink($dir . '/' . $readdir);
                         }
                     }
                 }
                 closedir($opendir);
                 @rmdir($dir);
             }
         }
         //regenerates all the pages
         CMS_tree::regenerateAllPages(true);
     }
     unset($this);
 }