Changeset 497


Ignore:
Timestamp:
08/09/2010 03:00:31 AM (18 months ago)
Author:
ofer
Message:

APC should not be taken for granted (thanks Martin)

Location:
trunk/WordPress/plugin/transposh/wp
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WordPress/plugin/transposh/wp/transposh_backup.php

    r492 r497  
    109109            $trans = split(',', $line); 
    110110            if ($trans[0]) 
    111             $this->transposh->database->restore_translation($trans[0], $trans[1], $trans[2], $trans[3], $trans[4]); 
     111                    $this->transposh->database->restore_translation($trans[0], $trans[1], $trans[2], $trans[3], $trans[4]); 
    112112        } 
    113         apc_clear_cache('user'); // clean up cache so that results will actually show 
     113        // clean up cache so that results will actually show 
     114        if (ENABLE_APC && function_exists('apc_clear_cache')) 
     115                apc_clear_cache('user'); 
    114116        exit; 
    115117    } 
  • trunk/WordPress/plugin/transposh/wp/transposh_db.php

    r492 r497  
    290290 
    291291            // If we have caching - we remove previous entry from cache 
    292             if (ENABLE_APC && function_exists('apc_store')) { 
     292            if (ENABLE_APC && function_exists('apc_delete')) { 
    293293                apc_delete($original . '___' . $lang); 
    294294            } 
     
    570570        $cleanup = 'DELETE ' . $GLOBALS['wpdb']->prefix . TRANSLATIONS_TABLE . ' ,' . $GLOBALS['wpdb']->prefix . TRANSLATIONS_LOG . 
    571571                ' FROM ' . $GLOBALS['wpdb']->prefix . TRANSLATIONS_TABLE . 
    572                 ' INNER JOIN '. $GLOBALS['wpdb']->prefix . TRANSLATIONS_LOG. 
    573                 ' ON '.$GLOBALS['wpdb']->prefix . TRANSLATIONS_TABLE .'.original = '.$GLOBALS['wpdb']->prefix . TRANSLATIONS_LOG .'.original'. 
    574                 ' AND '.$GLOBALS['wpdb']->prefix . TRANSLATIONS_TABLE .'.lang = '.$GLOBALS['wpdb']->prefix . TRANSLATIONS_LOG .'.lang'. 
    575                 ' WHERE '. $GLOBALS['wpdb']->prefix . TRANSLATIONS_TABLE.'.source > 0'. 
     572                ' INNER JOIN ' . $GLOBALS['wpdb']->prefix . TRANSLATIONS_LOG . 
     573                ' ON ' . $GLOBALS['wpdb']->prefix . TRANSLATIONS_TABLE . '.original = ' . $GLOBALS['wpdb']->prefix . TRANSLATIONS_LOG . '.original' . 
     574                ' AND ' . $GLOBALS['wpdb']->prefix . TRANSLATIONS_TABLE . '.lang = ' . $GLOBALS['wpdb']->prefix . TRANSLATIONS_LOG . '.lang' . 
     575                ' WHERE ' . $GLOBALS['wpdb']->prefix . TRANSLATIONS_TABLE . '.source > 0' . 
    576576                " AND timestamp < SUBDATE(NOW(),$days)"; 
    577         apc_clear_cache('user'); // clean up cache so that results will actually show 
     577        // clean up cache so that results will actually show 
     578        if (ENABLE_APC && function_exists('apc_clear_cache')) 
     579                apc_clear_cache('user'); 
     580 
    578581        $result = $GLOBALS['wpdb']->query($cleanup); 
    579582        exit; 
    580583    } 
    581584 
    582     function restore_translation($original,$lang,$translation,$by,$timestamp) { 
     585    function restore_translation($original, $lang, $translation, $by, $timestamp) { 
    583586        // TODO in future 
    584587        // if there is a newer human translation, just ignore this 
     
    589592        $values .= "('" . $original . "','" . $translation . "','" . $lang . "','" . $source . "')"; 
    590593        $delvalues .= "(original ='$original' AND lang='$lang')"; 
    591        // Setting the transaction log records 
    592         $logvalues .= "('" . $original . "','" . $translation . "','" . $lang . "','" . $by . "',FROM_UNIXTIME(" . $timestamp . "),'" . $source . "')" ; 
     594        // Setting the transaction log records 
     595        $logvalues .= "('" . $original . "','" . $translation . "','" . $lang . "','" . $by . "',FROM_UNIXTIME(" . $timestamp . "),'" . $source . "')"; 
    593596 
    594597        $update = "DELETE FROM " . $GLOBALS['wpdb']->prefix . TRANSLATIONS_TABLE . " WHERE $delvalues"; 
Note: See TracChangeset for help on using the changeset viewer.