コード例 #1
0
ファイル: VarienTest.php プロジェクト: nemphys/magento2
 /**
  * @param string $saveMethod
  * @param string $iniValue
  * @dataProvider sessionSaveMethodDataProvider
  */
 public function testSessionSaveMethod($saveMethod, $iniValue)
 {
     $this->markTestIncomplete('Bug MAGE-5487');
     // depending on configuration some values cannot be set as default save session handlers.
     // in such cases warnings will be generated by php and test will fail
     $origErrorRep = error_reporting(E_ALL ^ E_WARNING);
     $origSessionHandler = ini_set('session.save_handler', $iniValue);
     if ($iniValue && ini_get('session.save_handler') != $iniValue) {
         ini_set('session.save_handler', $origSessionHandler);
         error_reporting($origErrorRep);
         $this->markTestSkipped("Can't  set '{$iniValue}' as session save handler");
     }
     ini_set('session.save_handler', $origSessionHandler);
     Mage::getConfig()->setNode(Mage_Core_Model_Session_Abstract::XML_NODE_SESSION_SAVE, $saveMethod);
     /**
      * @var Mage_Core_Model_Session_Abstract_Varien
      */
     $model = new Mage_Core_Model_Session_Abstract();
     //There is no any possibility to determine whether session already started or not in php before 5.4
     $model->setSkipEmptySessionCheck(true);
     $model->start();
     if ($iniValue) {
         $this->assertEquals(ini_get('session.save_handler'), $iniValue);
     }
     ini_set('session.save_handler', $origSessionHandler);
     error_reporting($origErrorRep);
 }
コード例 #2
0
 /**
  * {@inheritDoc}
  */
 public function regenerate($destroy = false)
 {
     if (self::$sessionIdRegenerated) {
         return;
     }
     $this->session->regenerateSessionId();
     self::$sessionIdRegenerated = true;
 }
コード例 #3
0
 /**
  * Try to get the id of the customer
  * 
  * @return int|null
  */
 public function getCustomerId()
 {
     if (class_exists('Mage')) {
         return Mage::getSingleton('customer/session')->getCustomer()->getId();
     }
     return parent::getCustomerId();
 }
コード例 #4
0
ファイル: Session.php プロジェクト: CE-Webmaster/CE-Hub
 public function setSessionId($id = null)
 {
     if (!empty($this->_sid)) {
         $id = $this->_sid;
     }
     return parent::setSessionId($id);
 }
コード例 #5
0
 /**
  * Stores a post's comment data in the session in case of error
  *
  * @param Fishpig_Wordpress_Model_Post $post
  * @param string $author
  * @param string $email 
  * @param string $url
  * @param string $comment
  */
 public function setPostCommentData($post, $author, $email, $url, $comment)
 {
     if (is_object($post)) {
         $token = 'post_comment_data_' . $post->getId();
         $data = new Varien_Object(array('author' => $author, 'email' => $email, 'url' => $url, 'comment' => $comment));
         return parent::setData($token, $data);
     }
 }
コード例 #6
0
ファイル: Session.php プロジェクト: Man4x/Mageho_Atos
 /**
  * Unset all data associated with object
  */
 public function unsetAll()
 {
     parent::unsetAll();
     $this->_quoteId = null;
     $this->_response = null;
     $this->_redirectMessage = null;
     $this->_redirectTitle = null;
 }
コード例 #7
0
ファイル: Session.php プロジェクト: buttasg/cowgirlk
 public function addMessage(Mage_Core_Model_Message_Abstract $message)
 {
     $message->setIdentifier(uniqid() . '|' . $this->_now);
     return parent::addMessage($message);
 }
コード例 #8
0
 /**
  * Remove visitor-segment relation for specified website
  *
  * @param Mage_Core_Model_Session_Abstract $visitorSession
  * @param int $websiteId
  * @param array $segmentIds
  * @return Enterprise_CustomerSegment_Model_Customer
  */
 public function removeVisitorFromWebsiteSegments($visitorSession, $websiteId, $segmentIds)
 {
     $visitorCustomerSegmentIds = $visitorSession->getCustomerSegmentIds();
     if (!is_array($visitorCustomerSegmentIds)) {
         $visitorCustomerSegmentIds = array();
     }
     if (isset($visitorCustomerSegmentIds[$websiteId]) && is_array($visitorCustomerSegmentIds[$websiteId])) {
         $segmentsIdsForWebsite = $visitorCustomerSegmentIds[$websiteId];
         if (!empty($segmentIds)) {
             $segmentsIdsForWebsite = array_diff($segmentsIdsForWebsite, $segmentIds);
         }
         $visitorCustomerSegmentIds[$websiteId] = $segmentsIdsForWebsite;
     }
     $visitorSession->setCustomerSegmentIds($visitorCustomerSegmentIds);
     return $this;
 }
コード例 #9
0
ファイル: Abstract.php プロジェクト: relue/magento2
 /**
  * Get ecrypted session identifuer
  * No reason use crypt key for session id encryption
  * we can use session identifier as is
  *
  * @return string
  */
 public function getEncryptedSessionId()
 {
     if (!self::$_encryptedSessionId) {
         //            $helper = Mage::helper('Mage_Core_Helper_Data');
         //            if (!$helper) {
         //                return $this;
         //            }
         //            self::$_encryptedSessionId = $helper->encrypt($this->getSessionId());
         self::$_encryptedSessionId = $this->getSessionId();
     }
     return self::$_encryptedSessionId;
 }
コード例 #10
0
ファイル: AbstractTest.php プロジェクト: nemphys/magento2
 public function testGetSessionSavePath()
 {
     $this->assertEquals(Mage::getBaseDir('session'), $this->_model->getSessionSavePath());
 }
コード例 #11
0
 /**
  * Class constructor. Initialize Rede ClickPag session namespace
  */
 public function __construct()
 {
     parent::__construct();
     $this->init('rede_clickpag');
 }
コード例 #12
0
ファイル: Session.php プロジェクト: vberzsin/shop
 /**
  * Unset all data associated with object
  */
 public function unsetAll()
 {
     parent::unsetAll();
     $this->_quote = null;
 }
コード例 #13
0
ファイル: Abstract.php プロジェクト: cewolf2002/magento
 /**
  * Get encrypted session identifier.
  * No reason use crypt key for session id encryption, we can use session identifier as is.
  *
  * @return string
  */
 public function getEncryptedSessionId()
 {
     if (!self::$_encryptedSessionId) {
         self::$_encryptedSessionId = $this->getSessionId();
     }
     return self::$_encryptedSessionId;
 }
コード例 #14
0
ファイル: Session.php プロジェクト: natxetee/magento2
 /**
  * Reset core session hosts after reseting session ID
  *
  * @return Mage_Customer_Model_Session
  */
 public function renewSession()
 {
     parent::renewSession();
     $this->_cleanHosts();
     return $this;
 }
コード例 #15
0
ファイル: Session.php プロジェクト: AleksNesh/pandora
 public function unsetAll()
 {
     parent::unsetAll();
     $this->_collections = null;
 }
コード例 #16
0
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
require 'app/Mage.php';
Mage::app();
$test = in_array('--test', $argv);
$coreSession = new Mage_Core_Model_Session_Abstract();
$redisSession = new Cm_RedisSession_Model_Session();
$sessionPath = $coreSession->getSessionSavePath();
if (!is_readable($sessionPath) || !($dir = opendir($sessionPath))) {
    die("The session save path is not readable: {$sessionPath}\n");
}
if (!$redisSession->hasConnection()) {
    die("Could not connect to redis server, please check your configuration.\n");
}
$sessionLifetime = max(Mage::getStoreConfig('admin/security/session_cookie_lifetime'), Mage::getStoreConfig('web/cookie/cookie_lifetime'), 3600);
if (!in_array('-y', $argv)) {
    $redisConfig = Mage::getConfig()->getNode('global/redis_session');
    $redisConnection = $redisConfig->descend('host') . ':' . $redisConfig->descend('port') . '/' . $redisConfig->descend('db');
    $input = readline("Migrate sessions from {$sessionPath} to {$redisConnection} with {$sessionLifetime} second lifetime? (y|n) ");
    if ($input != 'y') {
        die("Aborted.\n");
コード例 #17
0
 /**
  * Get ecrypted session identifuer
  * No reason use crypt key for session id encryption
  * we can use session identifier as is
  *
  * @return string
  */
 public function getEncryptedSessionId()
 {
     if (!self::$_encryptedSessionId) {
         //            $helper = AO::helper('core');
         //            if (!$helper) {
         //                return $this;
         //            }
         //            self::$_encryptedSessionId = $helper->encrypt($this->getSessionId());
         self::$_encryptedSessionId = $this->getSessionId();
     }
     return self::$_encryptedSessionId;
 }
コード例 #18
0
ファイル: Session.php プロジェクト: cewolf2002/magento
 /**
  * Reset core session hosts after reseting session ID
  *
  * @return Mage_Customer_Model_Session
  */
 public function renewSession()
 {
     parent::renewSession();
     Mage::getSingleton('core/session')->unsSessionHosts();
     return $this;
 }
コード例 #19
0
ファイル: Abstract.php プロジェクト: arslbbt/mangentovies
 public function getEncryptedSessionId()
 {
     if (!self::$_encryptedSessionId) {
         $helper = Mage::helper('core');
         if (!$helper) {
             return $this;
         }
         self::$_encryptedSessionId = $helper->encrypt($this->getSessionId());
     }
     return self::$_encryptedSessionId;
 }
コード例 #20
0
ファイル: Session.php プロジェクト: xiaoguizhidao/devfashion
 public function unsetAll()
 {
     parent::unsetAll();
 }
コード例 #21
0
 public function __construct($data = array())
 {
     parent::__construct($data);
     $this->init(HooshMarketing_Marketo_Model_Lead::SESSION_NAMESPACE);
 }
コード例 #22
0
 public function start($sessionName = null)
 {
     parent::start($sessionName = null);
     $this->sessionIds[] = $this->getSessionId();
     return $this;
 }
コード例 #23
0
ファイル: Session.php プロジェクト: relue/magento2
 /**
  * Reset core session hosts after reseting session ID
  *
  * @return Mage_Customer_Model_Session
  */
 public function renewSession()
 {
     parent::renewSession();
     Mage::getSingleton('Mage_Core_Model_Session')->unsSessionHosts();
     return $this;
 }
コード例 #24
0
 /**
  * Pull out information from session whether there is currently the first page after log in
  *
  * The idea is to set this value on login(), then redirect happens,
  * after that on next request the value is grabbed once the session is initialized
  * Since the session is used as a singleton, the value will be in $_isFirstPageAfterLogin until the end of request,
  * unless it is reset intentionally from somewhere
  *
  * @param string $namespace
  * @param string $sessionName
  * @return Mage_Admin_Model_Session
  * @see self::login()
  */
 public function init($namespace, $sessionName = null)
 {
     parent::init($namespace, $sessionName);
     $this->isFirstPageAfterLogin();
     return $this;
 }
コード例 #25
0
 /**
  * Return all currently registered messages from block and specified session.
  *
  * @param Mage_Core_Model_Session_Abstract $session
  * @return array
  */
 protected function _getMessages(Mage_Core_Model_Session_Abstract $session)
 {
     $messages = array();
     $type = 'error';
     // If the message block already has been instantiated, get those messages
     /** @var $block Mage_Core_Block_Messages */
     if ($block = Mage::app()->getLayout()->getBlock('messages')) {
         $messages = array_merge($messages, $block->getMessages($type));
     }
     // Merge in the messages from the session
     $messages = array_merge($messages, $session->getMessages()->getItems($type));
     return $messages;
 }