Removed modules not being used

This commit is contained in:
Deon George
2011-08-31 11:47:27 +10:00
parent abfd2659cc
commit 2d02bde964
2557 changed files with 1 additions and 448709 deletions

View File

@@ -1,189 +0,0 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* Originally authored by Tony Landis, AgileBill LLC
*
* Recent modifications by Deon George
*
* @author Deon George <deonATleenooksDOTnet>
* @copyright 2009 Deon George
* @link http://osb.leenooks.net
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @subpackage Module:Task
*/
/**
* The main AgileBill Task Class
*
* @package AgileBill
* @subpackage Module:Task
* @todo Change the debug printing to use central debugging calls ie: C_alert
*/
class task extends OSB_module {
# Schedule Task ID
private $id = null;
# Does this task need authorisation
private $noauth = false;
/**
* Run all scheduled tasks
*
* @uses cron;
*/
public function run_all() {
include_once(PATH_INCLUDES.'cron/cron.inc.php');
$cron = new cron;
# Ensure that tasks complete and dont hang on running=1
set_time_limit(2*60*60);
# Loop through the tasks:
foreach ($this->sql_GetRecords(array('where'=>'(running=0 OR running IS NULL) AND status=1')) as $result) {
# Initialise the task
$this->id = $result['id'];
$this->noauth = false;
if ($this->debug)
printf("%s: Selecting Job [%s] (%s)\n",__METHOD__,$result['command'],$this->id);
$task = array();
$task['start'] = 0;
$task['end'] = 0;
$task['lastrun'] = (int)$result['date_run'];
$task['cron'] = sprintf('%s %s %s %s %s',
$result['int_min'],
$result['int_hour'],
$result['int_month_day'],
$result['int_month'],
$result['int_week_day']);
$task['now'] = (int)time();
# Default the last run time, if it isnt set
if (! $task['lastrun'] > 0)
$task['lastrun'] = $task['now']-86400*365;
# Verify it has not expired:
if ($task['start'] <= $task['now'] || $task['start'] == '' || $task['start'] == '0') {
# Verify it is past the start date:
if ($task['end'] >= $task['now'] || $task['end'] == '' || $task['end'] == '0') {
# Verify that it is time to run:
if ($cron->due($task['lastrun'],$task['now'],$task['cron'])) {
# Run the task:
if ($this->debug)
printf("%s: Running Job [%s] (%s)\n",__METHOD__,$result['command'],$this->id);
$this->run($this->VAR);
}
}
}
}
}
/**
* Run a task
*
* @uses task_log
*/
public function run($VAR) {
global $VAR,$C_auth,$_ENV,$_SERVER,$_COOKIE,$C_list,$C_method;
$db = &DB();
# Check if we are on a console, we'll debug output if we are
if (isset($_ENV['S']) ||
(isset($_ENV['SESSIONNAME']) && $_ENV['SESSIONNAME'] == 'Console') ||
(isset($_SERVER['SESSIONNAME']) && $_SERVER['SESSIONNAME'] == 'Console') ||
(isset($_SERVER['CLIENTNAME']) && $_SERVER['CLIENTNAME'] == 'Console') ||
empty($_COOKIE)) {
$this->debug = true;
$this->noauth = true;
# Can this task be run without authorisation
} elseif($C_auth->auth_method_by_name('task','run')) {
$this->noauth = true;
}
if (! isset($this->id)) {
if (isset($VAR['id']))
$this->id = $VAR['id'];
else
return false;
}
# Get task details
if (! $task = $this->sql_GetRecords(array('where'=>array('id'=>$this->id))))
return false;
$task = array_shift($task);
# Record task running
$db->Execute(sqlUpdate($db,'task',array('running'=>1),array('id'=>$this->id)));
if ($this->debug)
printf("%s: Running Task [%s]\n",__METHOD__,$task['command']);
# Run task
switch ($task['type']) {
# Internal function
case 0:
$cm = explode(':',$task['command']);
if ($this->noauth)
$C_method->exe_noauth($cm[0],$cm[1]);
else
$C_method->exe($cm[0],$cm[1]);
if ($C_method->result)
$result = 1;
else
$result = 0;
$message = isset($C_method->error) ? $C_method->error : '';
break;
# Run System Command:
case 1:
$message = `{$task['command']}`;
$result = 1;
break;
default:
printf('ERROR: Unknown task type [%s]',$result['type']);
}
# Update last run date & flip run toggle
$db->Execute(sqlUpdate($db,'task',array('running'=>0,'date_run'=>time()),array('id'=>$this->id)));
# Store task log if required
if ($task['log'] && $C_list->is_installed('task_log')) {
include_once(PATH_MODULES.'task_log/task_log.inc.php');
$tl = new task_log;
$tl->add(array(
'task_log_task_id'=>$this->id,
'task_log_result'=>$result,
'task_log_message'=>$message,
'_page_current'=>isset($VAR['_page_current']) ? $VAR['_page_current'] : '',
'_noredirect'=>1
));
}
# If admin, print success message
if (DEFAULT_ADMIN_THEME == SESS_THEME) {
global $C_translate,$C_debug;
$C_debug->alert($C_translate->translate('true','',''));
}
}
}
?>

View File

@@ -1,185 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<construct>
<!-- Module name -->
<module>task</module>
<!-- Module supporting database table -->
<table>task</table>
<!-- Module dependancy(s) (module wont install if these modules are not yet installed) -->
<dependancy></dependancy>
<!-- DB cache in seconds -->
<cache>0</cache>
<!-- Default order_by field for SQL queries -->
<order_by>name</order_by>
<!-- Default SQL limit for SQL queries -->
<limit>25</limit>
<!-- Schema version (used to determine if the schema has change during upgrades) -->
<version>1</version>
<!-- Database indexes -->
<index>
<start>date_start</start>
<expire>date_expire</expire>
</index>
<!-- Database fields -->
<field>
<!-- Record ID -->
<id>
<index>1</index>
<type>I4</type>
<unique>1</unique>
</id>
<!-- Site ID -->
<site_id>
<index>1</index>
<type>I4</type>
</site_id>
<!-- Date record created -->
<date_orig>
<display>Date Created</display>
<type>I8</type>
</date_orig>
<!-- Date record updated -->
<date_last>
<convert>date-now</convert>
<display>Date Updated</display>
<type>I8</type>
</date_last>
<!-- Date last run -->
<date_run>
<convert>date-now</convert>
<display>Date Last Run</display>
<type>I8</type>
</date_run>
<!-- Record active (BOOL)-->
<status>
<display>Active</display>
<type>I4</type>
</status>
<date_start>
<display>Date Start</display>
<type>I8</type>
<convert>date-time</convert>
</date_start>
<date_expire>
<display>Date Expire</display>
<type>I8</type>
<convert>date-time</convert>
</date_expire>
<name>
<display>Name</display>
<type>C(32)</type>
<min_len>3</min_len>
<max_len>32</max_len>
<validate>any</validate>
</name>
<description>
<display>Description</display>
<type>C(255)</type>
</description>
<!-- Log Task: (BOOL) -->
<log>
<display>Log</display>
<type>L</type>
</log>
<!-- Task type: 0=INTERNAL(run method), 1=EXTERNAL(run CMD) -->
<type>
<display>Type</display>
<type>I4</type>
</type>
<command>
<display>Command</display>
<type>C(128)</type>
<min_len>2</min_len>
<max_len>128</max_len>
<validate>any</validate>
</command>
<int_min>
<display>Minute</display>
<type>C(32)</type>
<min_len>1</min_len>
<max_len>32</max_len>
<validate>any</validate>
</int_min>
<int_hour>
<display>Hour</display>
<type>C(32)</type>
<min_len>1</min_len>
<max_len>32</max_len>
<validate>any</validate>
</int_hour>
<int_month>
<display>Month</display>
<type>C(32)</type>
<min_len>1</min_len>
<max_len>32</max_len>
<validate>any</validate>
</int_month>
<int_month_day>
<display>Day</display>
<type>C(32)</type>
<min_len>1</min_len>
<max_len>32</max_len>
<validate>any</validate>
</int_month_day>
<int_week_day>
<display>Week Day</display>
<type>C(32)</type>
<min_len>1</min_len>
<max_len>32</max_len>
<validate>any</validate>
</int_week_day>
<!-- Task is currently running: 1=RUNNING, 0|NULL=NOT RUNNING -->
<running>
<type>L</type>
</running>
</field>
<!-- Methods for this class, and the fields they have access to, if applicable -->
<method>
<add>date_start,date_expire,name,description,type,command,int_min,int_hour,int_month_day,int_month,int_week_day</add>
<update>id,name,status,log,date_start,date_expire,description,type,command,int_min,int_hour,int_month_day,int_month,int_week_day,running</update>
<delete>id</delete>
<view>id,name,date_last,date_run,status,log,date_start,date_expire,description,type,command,int_min,int_hour,int_month_day,int_month,int_week_day,running</view>
<search>id,name,date_last,date_run,command,status</search>
</method>
<!-- Method triggers -->
<trigger></trigger>
<!-- Template page display titles -->
<title>
<add>Add Task</add>
<view>Task</view>
</title>
<!-- Template helpers -->
<tpl>
<search_show>
<checkbox>
<field>id</field>
<type>checkbox</type>
<width>25px</width>
</checkbox>
<name>
<field>name</field>
</name>
<date_last>
<field>date_last</field>
<type>date</type>
</date_last>
<date_run>
<field>date_run</field>
<type>date</type>
</date_run>
<command>
<field>command</field>
</command>
<icon>
<field>status</field>
<type>bool_icon</type>
<width>20px</width>
</icon>
</search_show>
</tpl>
</construct>

View File

@@ -1,63 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<install>
<!-- Tree Menu Module Properties -->
<module_properties>
<!-- MODULE Dependancy, this module wont be installed if the dependant modules dont exist -->
<dependancy></dependancy>
<!-- Translated display to use on the tree -->
<display>Task</display>
<!-- Display a module in the menu tree -->
<menu_display>1</menu_display>
<!-- MODULE Name -->
<name>task</name>
<!-- MODULE Notes, these notes show up in the modules table, as a description of the module -->
<notes><![CDATA[This module allows you to automate various tasks]]></notes>
<!-- MODULE Parent, the parent node in the tree -->
<parent>setup</parent>
<!-- SUB Modules to install with this one -->
<sub_modules></sub_modules>
<!-- MODULE Type (core|base), core modules cannot be deleted, unrecognised types are ignored. -->
<type>base</type>
</module_properties>
<!-- Tree Menu & Module Methods to load, they will be assigned the group permissions on install time, as selected by the user. -->
<module_method>
<add>
<display>Add</display>
<menu_display>1</menu_display>
<name>add</name>
<notes><![CDATA[Add records]]></notes>
</add>
<delete>
<name>delete</name>
<notes><![CDATA[Delete records]]></notes>
</delete>
<search>
<display>List</display>
<menu_display>1</menu_display>
<name>search</name>
<notes><![CDATA[List records]]></notes>
<page><![CDATA[core:search&module=%%&_next_page_one=view]]></page>
</search>
<search_form>
<name>search_form</name>
<notes><![CDATA[Search for records]]></notes>
</search_form>
<search_show>
<name>search_show</name>
<notes><![CDATA[Show the results of a search]]></notes>
</search_show>
<update>
<name>update</name>
<notes><![CDATA[Update a record]]></notes>
</update>
<view>
<name>view</name>
<notes><![CDATA[View a record]]></notes>
</view>
<run>
<name>run</name>
<notes><![CDATA[Run a task]]></notes>
</run>
</module_method>
</install>

View File

@@ -1,290 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<install>
<task>
<id>3</id>
<site_id>1</site_id>
<date_start>0</date_start>
<date_expire>0</date_expire>
<date_last>1132899162</date_last>
<name>Database Cleanup</name>
<description>Cleans up old sessions and other data, optimizes and repairs the database tables, corrects bad key counters, and runs any new update scripts in the /upgrades directory.</description>
<log>1</log>
<type>0</type>
<command>core:cleanup</command>
<int_min>1</int_min>
<int_hour>*</int_hour>
<int_month>*</int_month>
<int_month_day>*</int_month_day>
<int_week_day>*</int_week_day>
<running>0</running>
</task>
<task>
<id>5</id>
<site_id>1</site_id>
<date_start>1098342000</date_start>
<date_expire>0</date_expire>
<date_last>1111365988</date_last>
<name>Service Queue</name>
<description>Runs the service queue to perform add, suspend, unsuspend, edit, delete, etc...</description>
<log>1</log>
<type>0</type>
<command>service:queue</command>
<int_min>0-59/5</int_min>
<int_hour>*</int_hour>
<int_month>*</int_month>
<int_month_day>*</int_month_day>
<int_week_day>*</int_week_day>
</task>
<task>
<id>6</id>
<site_id>1</site_id>
<date_start>1268467200</date_start>
<date_expire>0</date_expire>
<date_last>1099096879</date_last>
<name>Account Cleanup</name>
<description>Loop though all accounts to delete inactive accounts with no invoices, services, and no staff or affiliate accts</description>
<type>0</type>
<command>core:account_cleanup</command>
<int_min>0</int_min>
<int_hour>0</int_hour>
<int_month>*</int_month>
<int_month_day>*</int_month_day>
<int_week_day>*</int_week_day>
</task>
<task>
<id>7</id>
<site_id>1</site_id>
<date_start>0</date_start>
<date_expire>0</date_expire>
<date_last>1099096842</date_last>
<name>Invoice Cleanup</name>
<description><![CDATA[Delete inactive/unpaid invoices older than the allowed period, defined to 60 days by default in /modules/core/core.inc.php as the constant &quot;AGILE_INVOICE_CLEANUP_DAYS&quot;.
]]></description>
<type>0</type>
<command>core:invoice_cleanup</command>
<int_min>15</int_min>
<int_hour>*</int_hour>
<int_month>*</int_month>
<int_month_day>*</int_month_day>
<int_week_day>*</int_week_day>
</task>
<task>
<id>8</id>
<site_id>1</site_id>
<date_start>0</date_start>
<date_expire>0</date_expire>
<date_last>1111894623</date_last>
<name>Generate Invoices</name>
<description>This task generates any new invoices and sends the appropriate notices to the customers.</description>
<type>0</type>
<command>invoice:generate</command>
<int_min>5</int_min>
<int_hour>*</int_hour>
<int_month>*</int_month>
<int_month_day>*</int_month_day>
<int_week_day>*</int_week_day>
</task>
<task>
<id>9</id>
<site_id>1</site_id>
<date_start>0</date_start>
<date_expire>0</date_expire>
<date_last>1111525669</date_last>
<name>Invoice Autobilling</name>
<description>Performs the billing for due invoices sends out invoice alerts, reminders, decline, and suspend notices.</description>
<type>0</type>
<command>invoice:autobill</command>
<int_min>10</int_min>
<int_hour>*</int_hour>
<int_month>*</int_month>
<int_month_day>*</int_month_day>
<int_week_day>*</int_week_day>
</task>
<task>
<id>11</id>
<site_id>1</site_id>
<date_start>0</date_start>
<date_expire>0</date_expire>
<date_last>1102724394</date_last>
<name>Service Cleanup</name>
<description>Deactivate any expired one-time services that granted group access for a specific amount of days. If this task is run manually, the service queue task should be run afterwards.</description>
<type>0</type>
<command>service:cleanup</command>
<int_min>20</int_min>
<int_hour>*</int_hour>
<int_month>*</int_month>
<int_month_day>*</int_month_day>
<int_week_day>*</int_week_day>
</task>
<task>
<id>12</id>
<site_id>1</site_id>
<date_start>0</date_start>
<date_expire>0</date_expire>
<date_last>1110084311</date_last>
<name>Charge: Daily</name>
<type>0</type>
<command>charge:sweep_daily</command>
<int_min>0</int_min>
<int_hour>*</int_hour>
<int_month>*</int_month>
<int_month_day>*</int_month_day>
<int_week_day>*</int_week_day>
</task>
<task>
<id>59</id>
<site_id>1</site_id>
<date_start>0</date_start>
<date_expire>0</date_expire>
<date_last>1132899627</date_last>
<name>Credit Card Expiry</name>
<description>Locate credit cards expiring in the next 2 months and e-mail the user.</description>
<type>0</type>
<command>account_billing:task</command>
<int_min>0</int_min>
<int_hour>0</int_hour>
<int_month>*</int_month>
<int_month_day>*</int_month_day>
<int_week_day>3</int_week_day>
<running>0</running>
</task>
<task>
<id>60</id>
<site_id>1</site_id>
<date_start>0</date_start>
<date_expire>0</date_expire>
<date_last>1132899627</date_last>
<name>Invoice Delivery</name>
<description>Delivers the invoices via email.</description>
<type>0</type>
<command>invoice:task_email_invoices</command>
<int_min>0</int_min>
<int_hour>*</int_hour>
<int_month>*</int_month>
<int_month_day>*</int_month_day>
<int_week_day>*</int_week_day>
<running>0</running>
</task>
<task>
<id>61</id>
<site_id>1</site_id>
<date_start>0</date_start>
<date_expire>0</date_expire>
<date_last>1132899627</date_last>
<name>Net Terms</name>
<description>Performs Net Terms task.</description>
<type>0</type>
<command>net_term:task</command>
<int_min>30</int_min>
<int_hour>1</int_hour>
<int_month>*</int_month>
<int_month_day>*</int_month_day>
<int_week_day>*</int_week_day>
<running>0</running>
</task>
<task>
<id>62</id>
<site_id>1</site_id>
<date_start>0</date_start>
<date_expire>0</date_expire>
<date_last>1132899627</date_last>
<name>VoIP DID Refresh</name>
<description>Refreshes the DID pool by querying any DID providers.</description>
<type>0</type>
<command>voip_did_plugin:task</command>
<int_min>*</int_min>
<int_hour>*</int_hour>
<int_month>*</int_month>
<int_month_day>*</int_month_day>
<int_week_day>*</int_week_day>
<running>0</running>
</task>
<task>
<id>63</id>
<site_id>1</site_id>
<date_start>0</date_start>
<date_expire>0</date_expire>
<date_last>1132899627</date_last>
<name>VoIP Prepaid Notice and Cleanup</name>
<description>Performs VoIP prepaid cleanup of expired entries and sends low balance email notifications.</description>
<type>0</type>
<command>voip_prepaid:task</command>
<int_min>30</int_min>
<int_hour>*</int_hour>
<int_month>*</int_month>
<int_month_day>*</int_month_day>
<int_week_day>*</int_week_day>
<running>0</running>
</task>
<task>
<id>64</id>
<site_id>1</site_id>
<date_start>0</date_start>
<date_expire>0</date_expire>
<date_last>1132899627</date_last>
<name>VoIP Rating</name>
<description>Performs the VoIP CDR rating.</description>
<type>0</type>
<command>voip:task</command>
<int_min>5</int_min>
<int_hour>*</int_hour>
<int_month>*</int_month>
<int_month_day>*</int_month_day>
<int_week_day>*</int_week_day>
<running>0</running>
</task>
<task>
<id>65</id>
<site_id>1</site_id>
<date_start>0</date_start>
<date_expire>0</date_expire>
<date_last>1132899627</date_last>
<name>VoIP DID Pool Areas</name>
<description>Calculates the area of newly refreshed DIDs.</description>
<type>0</type>
<command>voip_pool:task_area</command>
<int_min>*</int_min>
<int_hour>*</int_hour>
<int_month>*</int_month>
<int_month_day>*</int_month_day>
<int_week_day>*</int_week_day>
<running>0</running>
</task>
<task>
<id>66</id>
<site_id>1</site_id>
<date_start>0</date_start>
<date_expire>0</date_expire>
<date_last>0</date_last>
<name>Pre Invoice Generation email</name>
<description>Sends out Invoice Generation Pre-Notification E-mail.</description>
<type>0</type>
<command>core:invoice_advance_notice</command>
<int_min>1</int_min>
<int_hour>6</int_hour>
<int_month>*</int_month>
<int_month_day>*</int_month_day>
<int_week_day>*</int_week_day>
<running>0</running>
</task>
<task_id>
<id>67</id>
<site_id>1</site_id>
<date_start>0</date_start>
<date_expire>0</date_expire>
<date_last>0</date_last>
<name>Currency Conversion Update</name>
<description>Retrieves currency conversions from XE.com and updates.</description>
<type>0</type>
<command>currency:task</command>
<int_min>0</int_min>
<int_hour>0</int_hour>
<int_month>*</int_month>
<int_month_day>*</int_month_day>
<int_week_day>2</int_week_day>
<running>0</running>
</task_id>
<task_id>
<id>68</id>
</task_id>
</install>