public function run() { if (!class_exists('CwLoadDataPage')) { include dirname(__FILE__) . '/CwLoadDataPage.php'; } $obj = new CwLoadDataPage(); $yesterday = strtotime('yesterday'); $year = date('Y', $yesterday); $month = date('n', $yesterday); $day = date('j', $yesterday); $plugin_settings = $this->config->get('PLUGIN_SETTINGS'); $archive = $this->config->get('ARCHIVE_DB'); $con = FannieDB::get($plugin_settings['WarehouseDatabase']); foreach ($obj->getModels() as $class) { $obj = new $class($con); $obj->refresh_data($archive, $month, $year, $day); } }
" /> </div> <p> <button type="submit" class="btn btn-default">Reoad Data</button> </p> </form> <div class="well"> You can use this page as a command line tool, too. It's a better option if there's <b>lots</b> of data to deal with. </div> <?php return ob_get_clean(); } } if (basename(__FILE__) == basename($_SERVER['PHP_SELF'])) { $obj = new CwLoadDataPage(); if (php_sapi_name() != 'cli') { $obj->draw_page(); } else { function print_cli_help() { echo "Usage: php CwReloadDataPage.php [-a || -m <model file>]\n"; echo "\t[ -d <year-month-day] || [-s <start month> <start year> [-e <end month> <end year>]]\n"; echo "Specify a single date or a range of months.\n"; } $start = array(); $end = array(); $day = array(); $file = False; $all = False; $models = $obj->getModels();