Login   Register  
PHP Classes
elePHPant
Icontem

File: crond.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of martin barker  >  lightweight MVC  >  crond.php  >  Download  
File: crond.php
Role: Application script
Content type: text/plain
Description: Searchs Controlers for cronAction and will run the method
Class: lightweight MVC
Implements the MVC design pattern
Author: By
Last change:
Date: 2010-11-25 03:03
Size: 1,185 bytes
 

Contents

Class file image Download
<?php
require_once("controllers/controller.php");
require_once(
"models/model.php");

set_time_limit(300);
ini_set("memory_limit","128M");

error_reporting(2047);
ini_set("display_errors",1);

function 
__autoload($class_name){
    
$className explode('_'$class_name);
    
$path "";
    foreach(
$className as $key => $val){
        
$path .= $val."/";
    }
    
$path substr($path0strlen($path)-1);
        require_once(
$path.".php");
}


$files = array();

$handle opendir('../controllers/');
while (
false !== ($file readdir($handle))) {
    
$ext end(explode('.'$file));
    if(
$ext == "php"$files[] = $file;
}

foreach(
$files as $key => $name){
    
$controlName current(explode('.',$name));
    if(
$name != "controller.php"){
        
$controlName "controllers_$controlName";
        
        
$controller = new $controlName(true);
        echo 
"Started parsing $controlName\r\n";
        if(
method_exists($controller"cronAction")){
            
$controller->cronAction();
            echo 
"Finished Parsing, $controlName and run cronAction\r\n";
        }else{
            echo 
"Finished Parsing, $controlName and cronAction was not found\r\n";
        }
    }
}
echo 
"Finished Parsing Controlers";
closedir($handle);
?>