76 lines
2.4 KiB
PHP
76 lines
2.4 KiB
PHP
<?php
|
|
/** \file scripts/other/tasks/twitter_cache.php
|
|
* \brief DI webinterface task manager script, twitter cache
|
|
* \author Rob Schalken, Core|Vision
|
|
* \version $Revision: 26247 $
|
|
* \date $Date: 2016-02-29 10:40:22 +0100 (Mon, 29 Feb 2016) $
|
|
*
|
|
* Twitter cache
|
|
*/
|
|
|
|
/************************************/
|
|
/* Twitter cache */
|
|
/************************************/
|
|
|
|
// Update twitter cache all skins
|
|
$skins = get_all_dirs($_PAGE_INFO['base_path'] . SKIN_DIR);
|
|
$languages = db_fetch_system_lang();
|
|
|
|
for ($j = 0; $j < sizeof($skins); $j++) {
|
|
// Get settings from ini file
|
|
$ini_file = get_all_files($_PAGE_INFO['base_path'] . SKIN_DIR . $skins[$j] . "/", array("ini"));
|
|
$_PAGE_INFO['ini'] = parse_ini_file($ini_file[0], true);
|
|
|
|
// Get footer blocks (max 4 blocks)
|
|
for ($i = 0; $i < 4; $i++) {
|
|
// Footers to find
|
|
$footers = array("footer" . $i);
|
|
if (is_array($languages)) {
|
|
foreach($languages as $key => $language) {
|
|
array_push($footers, "footer" . $i . "_" . $key);
|
|
}
|
|
}
|
|
|
|
if (is_array($footers)) {
|
|
foreach($footers as $footer) {
|
|
if (isset($_PAGE_INFO['ini'][$footer])) {
|
|
$linecount = 0;
|
|
$found = true;
|
|
do {
|
|
$found = (isset($_PAGE_INFO['ini'][$footer]["line" . $linecount]));
|
|
if ($found) {
|
|
$footer_value = explode(";", $_PAGE_INFO['ini'][$footer]["line" . $linecount]);
|
|
if (isset($footer_value[1])) {
|
|
switch(trim(strtolower($footer_value[1]))) {
|
|
case "last_tweets":
|
|
// Acquire mutex
|
|
if (db_mutex_acquire(RemoveExtension(basename(__FILE__)) . "_" . $params['task_id'] . "_" . $footer_value[2], 0)) {
|
|
// Update twitter cache
|
|
TwitterUpdateCache(trim($footer_value[2]), 10);
|
|
|
|
// Release mutex
|
|
db_mutex_release(RemoveExtension(basename(__FILE__)) . "_" . $params['task_id'] . "_" . $footer_value[2]);
|
|
}
|
|
|
|
break;
|
|
default:
|
|
// Do nothing :)
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Increment line count
|
|
$linecount++;
|
|
}
|
|
while($found);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Set handled flag
|
|
$handled = 1;
|
|
|
|
?>
|