forked from bikundo/livechat
/
cron.php
99 lines (84 loc) · 2.53 KB
/
cron.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?php
/**
* Copyright 2009-2015 Remigijus Kiminas
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
ini_set('error_reporting', E_ALL);
ini_set('register_globals', 0);
ini_set('display_errors', 1);
ini_set("max_execution_time", "3600");
require_once dirname(__FILE__)."/ezcomponents/Base/src/base.php";
function __autoload( $className )
{
ezcBase::autoload( $className );
}
ezcBase::addClassRepository( dirname(__FILE__).'/', dirname(__FILE__).'/lib/autoloads');
$input = new ezcConsoleInput();
$helpOption = $input->registerOption(
new ezcConsoleOption(
's',
'siteaccess',
ezcConsoleInput::TYPE_STRING
)
);
$cronjobPartOption = $input->registerOption(
new ezcConsoleOption(
'c',
'cronjob',
ezcConsoleInput::TYPE_STRING
)
);
$cronjobPathOption = $input->registerOption(
new ezcConsoleOption(
'p',
'path',
ezcConsoleInput::TYPE_STRING
)
);
$extensionPartOption = $input->registerOption(
new ezcConsoleOption(
'e',
'extension',
ezcConsoleInput::TYPE_STRING
)
);
try
{
$input->process();
}
catch ( ezcConsoleOptionException $e )
{
die( $e->getMessage() );
}
ezcBaseInit::setCallback(
'ezcInitDatabaseInstance',
'erLhcoreClassLazyDatabaseConfiguration'
);
$instance = erLhcoreClassSystem::instance();
$instance->SiteAccess = $helpOption->value;
$instance->SiteDir = dirname(__FILE__).'/';
$cfgSite = erConfigClassLhConfig::getInstance();
$defaultSiteAccess = $cfgSite->getSetting( 'site', 'default_site_access' );
$optionsSiteAccess = $cfgSite->getSetting('site_access_options',$helpOption->value);
$instance->Language = $optionsSiteAccess['locale'];
$instance->ThemeSite = $optionsSiteAccess['theme'];
$instance->WWWDirLang = '/'.$helpOption->value;
// php cron.php -s site_admin -c cron/workflow
// php cron.php -s site_admin -e customstatus -c cron/customcron
if ($extensionPartOption->value) {
include_once('extension/'.$extensionPartOption->value.'/modules/lh'.$cronjobPartOption->value.'.php');
} else {
include_once('modules/lh'.$cronjobPartOption->value.'.php');
}
?>