Refresh all locale files.

Return value

int Count of the number of files removed

2 calls to advagg_refresh_all_locale_files()
advagg_admin_refresh_locale_files_button dans ./advagg.admin.inc
Delete orphaned/expired advagg locks from the semaphore database table.
advagg_cron dans ./advagg.module
Implements hook_cron().

Fichier

./advagg.cache.inc, line 831

Code

function advagg_refresh_all_locale_files() {
    $locale_files = array();
    if (!module_exists('locale')) {
        return $locale_files;
    }
    $results = db_select('advagg_files', 'af')->fields('af')
        ->condition('af.filetype', 'js')
        ->condition('af.filesize', 0, '>')
        ->execute();
    $javascript = array();
    foreach ($results as $row) {
        $javascript[] = array(
            'type' => 'file',
            'data' => $row->filename,
        );
    }
    if (!empty($javascript)) {
        $javascript_before = $javascript;
        $language_before = $GLOBALS['language'];
        $language_list = language_list();
        foreach ($language_list as $lang) {
            if ($lang->enabled) {
                $GLOBALS['language'] = $lang;
                $javascript = $javascript_before;
                locale_js_alter($javascript);
                $locale_file = array_diff_key($javascript, $javascript_before);
                $locale_files += $locale_file;
            }
        }
        $GLOBALS['language'] = $language_before;
    }
    return $locale_files;
}