public function executeCron(sfWebRequest $request)
 {
     global $CFG;
     $this->checkAuthorization();
     $this->forward404Unless($request->isMethod(sfRequest::POST));
     $form = $request->getPostParameters();
     if ($form['schema'] == '1' || $form['schema'] == '2') {
         if ($form['schema'] == '1') {
             $schemaList = Doctrine::getTable('GcrEschool')->findAll();
         } else {
             $schemaList = Doctrine::getTable('GcrInstitution')->findAll();
         }
     } else {
         if ($app = GcrInstitutionTable::getApp($form['schema'])) {
             $schemaList = array($app);
         }
     }
     if (isset($schemaList) && $schemaList[0]->isMoodle()) {
         $count = GcrBackgroundProcessTypeMoodleCron::createProcess($schemaList);
     } else {
         $count = GcrBackgroundProcessTypeMaharaCron::createProcess($schemaList);
     }
     $_SESSION['adminEschoolActionMessage'] = 'Run Cron started, ' . $count . ' processes were created. (check debug/error.log for updates)';
     $this->redirect($CFG->current_app->getUrl() . '/admin/eschool');
 }
<?php

// mahara_cron.php
// Written/modified by: Steven Nelson
// On Date: 12/13/2010
// Description: This is a script that performs the same job as mahara's cron.
require_once dirname(__FILE__) . '/../config/ProjectConfiguration.class.php';
$configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'prod', false);
sfContext::createInstance($configuration);
$databaseManager = new sfDatabaseManager($configuration);
$databaseManager->loadConfiguration();
$institutions = Doctrine_Core::getTable('GcrInstitution')->findAll();
GcrBackgroundProcessTypeMaharaCron::createProcess($institutions);