public function __construct($name)
 {
     #$regex = '/^\s*([a-z]+(?:-[a-z]+)*)\s*(?:"([^"]+)")?$/';
     #
     #if (preg_match($regex, $line, $matches)) {
     #    $this->page_directory_name = $matches[1];
     #
     #    /**
     #     * Has the user overridden the title in the file.
     #     */
     #    if (count($matches) > 2) {
     #        $this->title = $matches[2];
     #    }
     #}
     #
     #$this->navigation_links_file = $navigation_links_file;
     parent::__construct($name);
     #        $this->includes_directory = $includes_directory;
 }
コード例 #2
0
ファイル: main.inc.php プロジェクト: saulhoward/haddock-cms
        } else {
            echo "{$plug_in_htaccess_filename} not file found!\n";
        }
    }
} else {
    echo "{$plug_ins_directory_name} not found!\n";
}
echo "\n";
/*
 * Find the core files.
 */
$core_directory_name = PROJECT_ROOT . '/haddock';
echo "Searching the Core Directory: \n{$core_directory_name}\n\n";
if (is_dir($core_directory_name)) {
    echo "{$core_directory_name} found\n";
    $core_directory = new FileSystem_Directory($core_directory_name);
    foreach ($core_directory->get_subdirectories() as $sd) {
        $core_htaccess_filename = $sd->get_name() . '/doc-root.htaccess';
        if (is_file($core_htaccess_filename)) {
            $htaccess_file_contents .= '## Start of the ' . $sd->basename() . " core module's file.\n";
            $htaccess_file_contents .= file_get_contents($core_htaccess_filename);
            $htaccess_file_contents .= '## End of the ' . $sd->basename() . " core module's file.\n";
        } else {
            echo "{$core_htaccess_filename} not file found!\n";
        }
    }
} else {
    echo "No core directory found!\n";
}
echo "\n";
/*
 public function __construct($name, HaddockProjectOrganisation_ModuleDirectory $module_directory)
 {
     parent::__construct($name);
     $this->module_directory = $module_directory;
 }
 public function do_actions()
 {
     /*
      * Backup the old file.
      */
     #echo "Backing up the old .htaccess file:\n\n";
     $htaccess_filename = PROJECT_ROOT . '/.htaccess';
     if (is_file($htaccess_filename)) {
         $seconds = date('U');
         $backup_filename = $htaccess_filename . '_' . $seconds;
         if (rename($htaccess_filename, $backup_filename)) {
             #echo "$htaccess_filename renamed $backup_filename\n";
         } else {
             throw new Exception("Unable to rename {$htaccess_filename} as {$backup_filename}!");
         }
     } else {
         #echo "No .htaccess file found!\n";
     }
     #echo "\n";
     $htaccess_file_contents = '';
     $date = date('Y-m-d');
     /*
      * Put a comment at the start of the file.
      */
     $htaccess_file_contents .= '##############################################################' . PHP_EOL;
     $htaccess_file_contents .= '## .htaccess file auto-generated on ' . $date . PHP_EOL;
     $htaccess_file_contents .= '## ' . PHP_EOL;
     $htaccess_file_contents .= '## DO NOT EDIT THIS FILE!' . PHP_EOL;
     $htaccess_file_contents .= '## ' . PHP_EOL;
     $htaccess_file_contents .= '## Find and edit the various doc-root.htaccess files in the' . PHP_EOL;
     $htaccess_file_contents .= '## plug-ins and then run PublicHTML_AssembleHTAccessCLIScript.' . PHP_EOL;
     $htaccess_file_contents .= '## ' . PHP_EOL;
     $htaccess_file_contents .= '##############################################################' . PHP_EOL;
     $htaccess_file_contents .= PHP_EOL;
     /*
      * Find the start core file.
      */
     #$start_core_filename = PROJECT_ROOT . '/haddock/start-of-doc-root.htaccess';
     $start_filename = PROJECT_ROOT . '/plug-ins/public-html/start-of-doc-root.htaccess';
     #echo "Looking for the start .ht fragment: \n$start_core_filename\n\n";
     if (is_file($start_filename)) {
         #echo "$start_core_filename found\n";
         $htaccess_file_contents .= '## Start of start file.' . PHP_EOL;
         $htaccess_file_contents .= file_get_contents($start_filename);
         $htaccess_file_contents .= '## End of start file.' . PHP_EOL;
         $htaccess_file_contents .= PHP_EOL;
     } else {
         #echo "$start_core_filename not file found!\n";
     }
     #echo "\n";
     /*
      * Find the project-specific file.
      */
     $project_specific_filename = PROJECT_ROOT . '/project-specific/doc-root.htaccess';
     #echo "Looking for the Project Specific file: \n$project_specific_filename\n\n";
     if (is_file($project_specific_filename)) {
         #echo "$project_specific_filename found\n";
         $htaccess_file_contents .= "## Start of project-specific file.\n";
         $htaccess_file_contents .= file_get_contents($project_specific_filename);
         $htaccess_file_contents .= "## End of project-specific file.\n";
         $htaccess_file_contents .= PHP_EOL;
     } else {
         #echo "$project_specific_filename not file found!\n";
     }
     #echo "\n";
     /*
      * Find the plug-in files.
      */
     $plug_ins_directory_name = PROJECT_ROOT . '/plug-ins';
     #echo "Searching the Plug-ins Directory: \n$plug_ins_directory_name\n\n";
     if (is_dir($plug_ins_directory_name)) {
         $plug_ins_directory = new FileSystem_Directory($plug_ins_directory_name);
         foreach ($plug_ins_directory->get_subdirectories() as $sd) {
             $plug_in_htaccess_filename = $sd->get_name() . '/doc-root.htaccess';
             if (is_file($plug_in_htaccess_filename)) {
                 #echo "Found .htaccess file fragment $plug_in_htaccess_filename.\n";
                 $htaccess_file_contents .= '## Start of the ' . $sd->basename() . ' plug-in module\'s file.' . PHP_EOL;
                 $htaccess_file_contents .= file_get_contents($plug_in_htaccess_filename);
                 $htaccess_file_contents .= '## End of the ' . $sd->basename() . ' plug-in module\'s file.' . PHP_EOL;
                 $htaccess_file_contents .= PHP_EOL;
             } else {
                 #echo "$plug_in_htaccess_filename not file found!\n";
             }
         }
     } else {
         #echo "$plug_ins_directory_name not found!\n";
     }
     #echo "\n";
     ########################################
     # DEPRECATED!
     #
     # The script does not search in the core modules' directory anymore,
     # because the Public HTML module is now a plug-in.
     #
     ########################################
     #/*
     # * Find the core files.
     # */
     #$core_directory_name = PROJECT_ROOT . '/haddock';
     #
     ##echo "Searching the Core Directory: \n$core_directory_name\n\n";
     #
     #if (is_dir($core_directory_name)) {
     #	#echo "$core_directory_name found\n";
     #
     #	$core_directory = new FileSystem_Directory($core_directory_name);
     #
     #	foreach ($core_directory->get_subdirectories() as $sd) {
     #		$core_htaccess_filename = $sd->get_name() . '/doc-root.htaccess';
     #
     #		if (is_file($core_htaccess_filename)) {
     #			$htaccess_file_contents .= '## Start of the ' . $sd->basename() . " core module's file.\n";
     #
     #			$htaccess_file_contents .= file_get_contents($core_htaccess_filename);
     #
     #			$htaccess_file_contents .= '## End of the ' . $sd->basename() . " core module's file.\n";
     #		} else {
     #			#echo "$core_htaccess_filename not file found!\n";
     #		}
     #	}
     #} else {
     #	#echo "No core directory found!\n";
     #}
     #echo "\n";
     /*
      * Find the end core file.
      */
     #$end_core_filename = PROJECT_ROOT . '/haddock/end-of-doc-root.htaccess';
     $end_filename = PROJECT_ROOT . '/plug-ins/public-html/end-of-doc-root.htaccess';
     #echo "Looking for the end .ht fragment: \n$end_core_filename\n\n";
     if (is_file($end_filename)) {
         #echo "$end_core_filename found\n";
         $htaccess_file_contents .= '## Start of end core file.' . PHP_EOL;
         $htaccess_file_contents .= file_get_contents($end_filename);
         $htaccess_file_contents .= '## End of end core file.' . PHP_EOL;
         $htaccess_file_contents .= PHP_EOL;
     } else {
         #echo "$end_core_filename not file found!\n";
     }
     #echo "\n";
     /*
      * Write the file.
      */
     #echo "Writing the .htaccess file: \n\n$htaccess_filename\n";
     if ($fh = fopen($htaccess_filename, 'w')) {
         fwrite($fh, $htaccess_file_contents);
         fclose($fh);
     } else {
         throw new Exception("Unable to open {$htaccess_filename} for writing!");
     }
 }
 public function get_cli_script_directories()
 {
     $cli_script_directories = array();
     $bin_includes_directory_name = $this->get_name() . '/bin-includes/scripts';
     #echo "\$bin_includes_directory_name: $bin_includes_directory_name\n";
     if (is_dir($bin_includes_directory_name)) {
         $bin_includes_directory = new FileSystem_Directory($bin_includes_directory_name);
         $directories = $bin_includes_directory->get_subdirectories();
         foreach ($directories as $dir) {
             $cli_script_directories[] = new HaddockProjectOrganisation_CLIScriptDirectory($dir->get_name());
         }
     }
     return $cli_script_directories;
 }
コード例 #6
0
ファイル: main.inc.php プロジェクト: saulhoward/haddock-cms
/**
 * The main .INC file for the SVN repos dump script.
 *
 * @copyright Clear Line Web Design, 2007-02-09
 */
/*
 * Define the necessary classes.
 */
require_once PROJECT_ROOT . '/haddock/file-system/classes/' . 'FileSystem_Directory.inc.php';
require_once PROJECT_ROOT . '/haddock/file-system/classes/' . 'FileSystem_SVNRepositoryDirectory.inc.php';
require_once PROJECT_ROOT . '/project-specific/classes/' . 'ServerAdminScripts_SVNRepositoryDumpDirectory.inc.php';
/*
 * Create an array of repos objects.
 */
$repositories_directory = new FileSystem_Directory($repositories_directory_name);
$repositories = array();
foreach ($repositories_directory->get_subdirectories() as $sub_dir) {
    $repositories[] = new FileSystem_SVNRepositoryDirectory($sub_dir->get_name());
}
if (!$silent) {
    if (count($repositories) == 0) {
        echo "No repositories found!\n";
    } else {
        echo count($repositories) . " repositories found:\n";
        foreach ($repositories as $repos) {
            echo $repos->basename() . "\t" . $repos->youngest() . "\n";
        }
    }
}
/*
 public function __construct($name, HaddockProjectOrganisation_IncludesDirectory $includes_directory)
 {
     parent::__construct($name);
     $this->includes_directory = $includes_directory;
 }
 public function __construct($name, HaddockProjectOrganisation_ProjectDirectory $project_directory)
 {
     parent::__construct($name);
     $this->project_directory = $project_directory;
 }
コード例 #9
0
 public function __construct($name, CLIScripts_BinIncludesDirectory $bin_includes_directory)
 {
     parent::__construct($name);
     $this->bin_includes_directory = $bin_includes_directory;
 }
コード例 #10
0
 public function __construct($name, CLIScripts_ScriptsDirectory $scripts_directory)
 {
     parent::__construct($name);
     $this->scripts_directory = $scripts_directory;
 }
 public function do_actions()
 {
     /*
      * Backup the old file.
      */
     echo "Backing up the old .htaccess file:\n\n";
     $htaccess_filename = PROJECT_ROOT . '/.htaccess';
     if (is_file($htaccess_filename)) {
         $seconds = date('U');
         $backup_filename = $htaccess_filename . '_' . $seconds;
         if (rename($htaccess_filename, $backup_filename)) {
             echo "{$htaccess_filename} renamed {$backup_filename}\n";
         } else {
             throw new Exception("Unable to rename {$htaccess_filename} as {$backup_filename}!");
         }
     } else {
         echo "No .htaccess file found!\n";
     }
     echo "\n";
     $htaccess_file_contents = '';
     $date = date('Y-m-d');
     /*
      * Put a comment at the start of the file.
      */
     $htaccess_file_contents .= "########################################################### \n";
     $htaccess_file_contents .= "## .htaccess file auto-generated on {$date}.\n";
     $htaccess_file_contents .= "## \n";
     $htaccess_file_contents .= "## DO NOT EDIT THIS FILE!\n";
     $htaccess_file_contents .= "## \n";
     $htaccess_file_contents .= "## Find and edit the various doc-root.htaccess files and \n";
     $htaccess_file_contents .= "## then run the assemble-htaccess script in the public-html\n";
     $htaccess_file_contents .= "## core module.\n";
     $htaccess_file_contents .= "########################################################### \n";
     $htaccess_file_contents .= "\n";
     /*
      * Find the start core file.
      */
     $start_core_filename = PROJECT_ROOT . '/haddock/start-of-doc-root.htaccess';
     echo "Looking for the start .ht fragment: \n{$start_core_filename}\n\n";
     if (is_file($start_core_filename)) {
         echo "{$start_core_filename} found\n";
         $htaccess_file_contents .= "## Start of start core file.\n";
         $htaccess_file_contents .= file_get_contents($start_core_filename);
         $htaccess_file_contents .= "## End of start core file.\n";
     } else {
         echo "{$start_core_filename} not file found!\n";
     }
     echo "\n";
     /*
      * Find the project-specific file.
      */
     $project_specific_filename = PROJECT_ROOT . '/project-specific/doc-root.htaccess';
     echo "Looking for the Project Specific file: \n{$project_specific_filename}\n\n";
     if (is_file($project_specific_filename)) {
         echo "{$project_specific_filename} found\n";
         $htaccess_file_contents .= "## Start of project-specific file.\n";
         $htaccess_file_contents .= file_get_contents($project_specific_filename);
         $htaccess_file_contents .= "## End of project-specific file.\n";
     } else {
         echo "{$project_specific_filename} not file found!\n";
     }
     echo "\n";
     /*
      * Find the plug-in files.
      */
     $plug_ins_directory_name = PROJECT_ROOT . '/plug-ins';
     echo "Searching the Plug-ins Directory: \n{$plug_ins_directory_name}\n\n";
     if (is_dir($plug_ins_directory_name)) {
         $plug_ins_directory = new FileSystem_Directory($plug_ins_directory_name);
         foreach ($plug_ins_directory->get_subdirectories() as $sd) {
             $plug_in_htaccess_filename = $sd->get_name() . '/doc-root.htaccess';
             if (is_file($plug_in_htaccess_filename)) {
                 echo "Found .htaccess file fragment {$plug_in_htaccess_filename}.\n";
                 $htaccess_file_contents .= '## Start of the ' . $sd->basename() . " plug-in module's file.\n";
                 $htaccess_file_contents .= file_get_contents($plug_in_htaccess_filename);
                 $htaccess_file_contents .= '## End of the ' . $sd->basename() . " plug-in module's file.\n";
             } else {
                 echo "{$plug_in_htaccess_filename} not file found!\n";
             }
         }
     } else {
         echo "{$plug_ins_directory_name} not found!\n";
     }
     echo "\n";
     /*
      * Find the core files.
      */
     $core_directory_name = PROJECT_ROOT . '/haddock';
     echo "Searching the Core Directory: \n{$core_directory_name}\n\n";
     if (is_dir($core_directory_name)) {
         echo "{$core_directory_name} found\n";
         $core_directory = new FileSystem_Directory($core_directory_name);
         foreach ($core_directory->get_subdirectories() as $sd) {
             $core_htaccess_filename = $sd->get_name() . '/doc-root.htaccess';
             if (is_file($core_htaccess_filename)) {
                 $htaccess_file_contents .= '## Start of the ' . $sd->basename() . " core module's file.\n";
                 $htaccess_file_contents .= file_get_contents($core_htaccess_filename);
                 $htaccess_file_contents .= '## End of the ' . $sd->basename() . " core module's file.\n";
             } else {
                 echo "{$core_htaccess_filename} not file found!\n";
             }
         }
     } else {
         echo "No core directory found!\n";
     }
     echo "\n";
     /*
      * Find the end core file.
      */
     $end_core_filename = PROJECT_ROOT . '/haddock/end-of-doc-root.htaccess';
     echo "Looking for the end .ht fragment: \n{$end_core_filename}\n\n";
     if (is_file($end_core_filename)) {
         echo "{$end_core_filename} found\n";
         $htaccess_file_contents .= "## Start of end core file.\n";
         $htaccess_file_contents .= file_get_contents($end_core_filename);
         $htaccess_file_contents .= "## End of end core file.\n";
     } else {
         echo "{$end_core_filename} not file found!\n";
     }
     echo "\n";
     /*
      * Write the file.
      */
     echo "Writing the .htaccess file: \n\n{$htaccess_filename}\n";
     if ($fh = fopen($htaccess_filename, 'w')) {
         fwrite($fh, $htaccess_file_contents);
         fclose($fh);
     } else {
         throw new Exception("Unable to open {$htaccess_filename} for writing!");
     }
 }