/_build/build.schema.php
PHP | 95 lines | 55 code | 5 blank | 35 comment | 0 complexity | 414627c1d222707253081d204dbd62c7 MD5 | raw file
Possible License(s): AGPL-1.0
- <?php
- /**
- * miniShop
- *
- * Copyright 2012 by Vasiliy Naumkin <bezumkin@yandex.ru>
- *
- * miniShop 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 of the License, or (at your option) any later
- * version.
- *
- * miniShop 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
- * miniShop; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * @package minishop
- */
- /**
- * Build Schema script
- *
- * @package minishop
- * @subpackage build
- */
- $mtime = microtime();
- $mtime = explode(" ", $mtime);
- $mtime = $mtime[1] + $mtime[0];
- $tstart = $mtime;
- set_time_limit(0);
- /* define package name */
- define('PKG_NAME','miniShop');
- define('PKG_NAME_LOWER',strtolower(PKG_NAME));
- /* define sources */
- $root = dirname(dirname(__FILE__)).'/';
- $sources = array(
- 'root' => $root,
- 'core' => $root.'core/components/'.PKG_NAME_LOWER.'/',
- 'model' => $root.'core/components/'.PKG_NAME_LOWER.'/model/',
- 'assets' => $root.'assets/components/'.PKG_NAME_LOWER.'/',
- );
- /* load modx and configs */
- require_once dirname(__FILE__) . '/build.config.php';
- include_once MODX_CORE_PATH . 'model/modx/modx.class.php';
- $modx= new modX();
- $modx->initialize('mgr');
- $modx->loadClass('transport.modPackageBuilder','',false, true);
- echo '<pre>'; /* used for nice formatting of log messages */
- $modx->setLogLevel(modX::LOG_LEVEL_INFO);
- $modx->setLogTarget('ECHO');
- $manager= $modx->getManager();
- $generator= $manager->getGenerator();
- $generator->classTemplate= <<<EOD
- <?php
- /**
- * [+phpdoc-package+]
- */
- class [+class+] extends [+extends+] {}
- ?>
- EOD;
- $generator->platformTemplate= <<<EOD
- <?php
- /**
- * [+phpdoc-package+]
- */
- require_once (strtr(realpath(dirname(dirname(__FILE__))), '\\\\', '/') . '/[+class-lowercase+].class.php');
- class [+class+]_[+platform+] extends [+class+] {}
- ?>
- EOD;
- $generator->mapHeader= <<<EOD
- <?php
- /**
- * [+phpdoc-package+]
- */
- EOD;
- $generator->parseSchema($sources['model'] . 'schema/'.PKG_NAME_LOWER.'.mysql.schema.xml', $sources['model']);
- $mtime= microtime();
- $mtime= explode(" ", $mtime);
- $mtime= $mtime[1] + $mtime[0];
- $tend= $mtime;
- $totalTime= ($tend - $tstart);
- $totalTime= sprintf("%2.4f s", $totalTime);
- echo "\nExecution time: {$totalTime}\n";
- exit ();