Example #1
0
<?php

// Make sure the user is root
CLI_User::verify(CLI_User::SCRIPT_DIES_ON_FAILURE, "root");
$files = File_Scan::scanRecursive(APP_PATH, "*.php");
var_dump($files);
require dirname(ROUTE_SECOND_PATH) . "/includes/install_header.php";
// Connect to database with admin user
Database::initRoot();
// Run Global Script
require dirname(ROUTE_SECOND_PATH) . "/includes/install_global.php";
// Display the Header
require HEADER_PATH;
// Display the Page
echo '
<h1>Installation: Classes</h1>

<h3>Step #1 - Install Core Classes</h3>

<p>The core plugins are the plugins that are provided by default in the engine. The core functionality of the system depends on many of these plugins. This step will automatically install them.</p>';
// Loop through each class and install it
$configPaths = File_Scan::scanRecursive(SYS_PATH . "/core-classes", "*.config.php");
foreach ($configPaths as $configPath) {
    // Extract the name of this class
    $class = str_replace(".config.php", "", basename($configPath));
    // Load the Class's Config Class
    if (!($classConfig = Classes_Meta::getConfig($class, SYS_PATH . "/core-classes"))) {
        echo '<h4 style="color:red;">' . $class . '</h4>
		<p><span style="color:red;">The class\'s config class was inaccessible.</span></p>';
    }
    // Install the Class
    $installed = Classes_Meta::install($class);
    switch ($installed) {
        case Classes_Meta::DEPENDENCIES_MISSING:
            $details = '<span style="color:red; font-weight:700;">This installation requires dependencies that were not installed properly.</span>';
            break;
        case Classes_Meta::INSTALL_FAILED:
Database::initRoot();
// Run Global Script
require dirname(ROUTE_SECOND_PATH) . "/includes/install_global.php";
// Display the Header
require HEADER_PATH;
// Display the Page
echo '
<h1>Installation: Classes</h1>

<h3>Step #1 - Install Application Classes</h3>

<p>These plugins will ONLY be used within the `' . SITE_HANDLE . '` application you are setting up - NOT through the entire system. By default, they must be saved in your application in the /classes directory.</p>

<p>Note: Application plugins will overwrite the functionality of core and plugin classes if you use the same plugin name.</p>';
// Loop through each class and install it
$configPaths = File_Scan::scanRecursive(APP_PATH . "/classes", "*.config.php");
foreach ($configPaths as $configPath) {
    // Extract the name of this class
    $class = str_replace(".config.php", "", basename($configPath));
    // Load the Class's Config Class
    if (!($classConfig = Classes_Meta::getConfig($class, APP_PATH . "/classes"))) {
        echo '<h4 style="color:red;">' . $class . '</h4>
		<p><span style="color:red;">The plugin\'s config class was inaccessible.</span></p>';
        continue;
    }
    // Bypass installation plugins
    if ($class == "Install") {
        $installed = Install::setup() ? 1 : -1;
    } else {
        // Install Standard Class Types  (not installation)
        $installed = Classes_Meta::install($class);