/_build/build.schema.php
https://github.com/Mark-H/MODX-CMP-Defaults · PHP · 139 lines · 46 code · 6 blank · 87 comment · 0 complexity · ee161e624db6d2fff901e0a2cfaa5e70 MD5 · raw file
- <?php
- /**
- * ExtraName
- *
- * Copyright 2011 by Mark Hamstra <hello@markhamstra.com>
- *
- * This file is part of ExtraName.
- *
- * ExtraName 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.
- *
- * ExtraName 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
- * ExtraName; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
- * Suite 330, Boston, MA 02111-1307 USA
- *
- */
- $mtime = microtime();
- $mtime = explode(" ", $mtime);
- $mtime = $mtime[1] + $mtime[0];
- $tstart = $mtime;
- set_time_limit(0);
- require_once dirname(dirname(__FILE__)) . '/config.core.php';
- include_once MODX_CORE_PATH . 'model/modx/modx.class.php';
- $modx= new modX();
- $modx->initialize('mgr');
- $modx->loadClass('transport.modPackageBuilder','',false, true);
- $modx->setLogLevel(modX::LOG_LEVEL_INFO);
- $modx->setLogTarget(XPDO_CLI_MODE ? 'ECHO' : 'HTML');
- $root = dirname(dirname(__FILE__)).'/';
- $sources = array(
- 'root' => $root,
- 'core' => $root.'core/components/extraname/',
- 'model' => $root.'core/components/extraname/model/',
- 'assets' => $root.'assets/components/extraname/',
- 'schema' => $root.'_build/schema/',
- );
- $manager= $modx->getManager();
- $generator= $manager->getGenerator();
- $generator->classTemplate= <<<EOD
- <?php
- /**
- * ExtraName
- *
- * Copyright 2011 by Mark Hamstra <hello@markhamstra.com>
- *
- * This file is part of ExtraName, a real estate property listings component
- * for MODX Revolution.
- *
- * ExtraName 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.
- *
- * ExtraName 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
- * ExtraName; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
- * Suite 330, Boston, MA 02111-1307 USA
- *
- */
- class [+class+] extends [+extends+] {}
- ?>
- EOD;
- $generator->platformTemplate= <<<EOD
- <?php
- /**
- * ExtraName
- *
- * Copyright 2011 by Mark Hamstra <hello@markhamstra.com>
- *
- * This file is part of ExtraName, a real estate property listings component
- * for MODX Revolution.
- *
- * ExtraName 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.
- *
- * ExtraName 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
- * ExtraName; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
- * Suite 330, Boston, MA 02111-1307 USA
- *
- */
- require_once (strtr(realpath(dirname(dirname(__FILE__))), '\\\\', '/') . '/[+class-lowercase+].class.php');
- class [+class+]_[+platform+] extends [+class+] {}
- ?>
- EOD;
- $generator->mapHeader= <<<EOD
- <?php
- /**
- * ExtraName
- *
- * Copyright 2011 by Mark Hamstra <hello@markhamstra.com>
- *
- * This file is part of ExtraName, a real estate property listings component
- * for MODX Revolution.
- *
- * ExtraName 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.
- *
- * ExtraName 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
- * ExtraName; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
- * Suite 330, Boston, MA 02111-1307 USA
- *
- */
- EOD;
- $generator->parseSchema($sources['schema'].'extraname.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 ();