Ejemplo n.º 1
0
 /**
  * Sets necessary instances for this class.
  */
 public function __construct()
 {
     $languages = new Translation();
     $this->lang = $languages->getFromFile('classes', 'mysql');
     $this->db = MySQLQuery::getInstance();
     $this->loadResources('mysql');
 }
Ejemplo n.º 2
0
defined('UTILS_PATH') || define('UTILS_PATH', realpath(dirname(__FILE__) . '/../Library/Utils'));
// Add framework and application paths to the PHP path environment
set_include_path(implode(PATH_SEPARATOR, array(realpath(APPLICATION_PATH), realpath(UTILS_PATH), get_include_path())));
require_once '../src/Application/autoloader.php';
use Lib\Init;
use Lib\MySQLQuery;
use Application\Models\Create;
use Application\Models\Update;
// Set initial configuration
$init = new Init();
$init->setup();
if (count($argv) == 1) {
    echo "You must enter a parameter!\n";
} else {
    switch ($argv[1]) {
        case 'schema:create':
            $db = MySQLQuery::getInstance();
            $query = Create::Run();
            $db->run($query);
            echo "Database schema was created successfully!\n";
            break;
        case 'schema:update':
            $db = MySQLQuery::getInstance();
            $query = Update::Run();
            $db->run($query);
            echo "Database schema was update successfully!\n";
            break;
        default:
            echo "Please give one of the permit parameters!\n";
    }
}