PMA\libraries\Util::cacheSet PHP Method

cacheSet() public static method

Caches information in the session
public static cacheSet ( string $var, mixed $val = null ) : mixed
$var string variable name
$val mixed value
return mixed
    public static function cacheSet($var, $val = null)
    {
        $_SESSION['cache']['server_' . $GLOBALS['server']][$var] = $val;
    }

Usage Example

 /**
  * Prepares environment for the test.
  *
  * @return void
  */
 public function setUp()
 {
     //$_REQUEST
     $_REQUEST['log'] = "index1";
     $_REQUEST['pos'] = 3;
     //$GLOBALS
     $GLOBALS['cfg']['MaxRows'] = 10;
     $GLOBALS['server'] = 1;
     $GLOBALS['cfg']['ServerDefault'] = "server";
     $GLOBALS['cfg']['RememberSorting'] = true;
     $GLOBALS['cfg']['SQP'] = array();
     $GLOBALS['cfg']['MaxCharactersInDisplayedSQL'] = 1000;
     $GLOBALS['cfg']['ShowSQL'] = true;
     $GLOBALS['cfg']['TableNavigationLinksMode'] = 'icons';
     $GLOBALS['cfg']['LimitChars'] = 100;
     $GLOBALS['table'] = "table";
     $GLOBALS['pmaThemeImage'] = 'image';
     //$_SESSION
     $_SESSION['PMA_Theme'] = Theme::load('./themes/pmahomme');
     $_SESSION['PMA_Theme'] = new Theme();
     Util::cacheSet('profiling_supported', true);
     $binary_log_file_names = array();
     $binary_log_file_names[] = array("Log_name" => "index1", "File_size" => 100);
     $binary_log_file_names[] = array("Log_name" => "index2", "File_size" => 200);
     //Mock DBI
     $dbi = $this->getMockBuilder('PMA\\libraries\\DatabaseInterface')->disableOriginalConstructor()->getMock();
     $dbi->expects($this->once())->method('fetchResult')->will($this->returnValue($binary_log_file_names));
     $container = Container::getDefaultContainer();
     $container->set('dbi', $dbi);
 }
All Usage Examples Of PMA\libraries\Util::cacheSet
Util