import v2.0.0.0_RC3 | 2012-07-01
https://github.com/lucanos/CommunityID -> http://www.itadmins.net/archives/357
This commit is contained in:
@ -16,7 +16,7 @@
|
||||
* @package Zend_Config
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Array.php 16201 2009-06-21 18:51:15Z thomas $
|
||||
* @version $Id: Array.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -38,14 +38,14 @@ class Zend_Config_Writer_Array extends Zend_Config_Writer
|
||||
* @var string
|
||||
*/
|
||||
protected $_filename = null;
|
||||
|
||||
|
||||
/**
|
||||
* Wether to exclusively lock the file or not
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $_exclusiveLock = false;
|
||||
|
||||
|
||||
/**
|
||||
* Set the target filename
|
||||
*
|
||||
@ -55,10 +55,10 @@ class Zend_Config_Writer_Array extends Zend_Config_Writer
|
||||
public function setFilename($filename)
|
||||
{
|
||||
$this->_filename = $filename;
|
||||
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set wether to exclusively lock the file or not
|
||||
*
|
||||
@ -68,10 +68,10 @@ class Zend_Config_Writer_Array extends Zend_Config_Writer
|
||||
public function setExclusiveLock($exclusiveLock)
|
||||
{
|
||||
$this->_exclusiveLock = $exclusiveLock;
|
||||
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defined by Zend_Config_Writer
|
||||
*
|
||||
@ -87,43 +87,43 @@ class Zend_Config_Writer_Array extends Zend_Config_Writer
|
||||
if ($filename !== null) {
|
||||
$this->setFilename($filename);
|
||||
}
|
||||
|
||||
|
||||
if ($config !== null) {
|
||||
$this->setConfig($config);
|
||||
}
|
||||
|
||||
|
||||
if ($exclusiveLock !== null) {
|
||||
$this->setExclusiveLock($exclusiveLock);
|
||||
}
|
||||
|
||||
|
||||
if ($this->_filename === null) {
|
||||
require_once 'Zend/Config/Exception.php';
|
||||
throw new Zend_Config_Exception('No filename was set');
|
||||
}
|
||||
|
||||
|
||||
if ($this->_config === null) {
|
||||
require_once 'Zend/Config/Exception.php';
|
||||
throw new Zend_Config_Exception('No config was set');
|
||||
}
|
||||
|
||||
|
||||
$data = $this->_config->toArray();
|
||||
$sectionName = $this->_config->getSectionName();
|
||||
|
||||
|
||||
if (is_string($sectionName)) {
|
||||
$data = array($sectionName => $data);
|
||||
}
|
||||
|
||||
|
||||
$arrayString = "<?php\n"
|
||||
. "return " . var_export($data, true) . ";\n";
|
||||
|
||||
|
||||
$flags = 0;
|
||||
|
||||
|
||||
if ($this->_exclusiveLock) {
|
||||
$flags |= LOCK_EX;
|
||||
}
|
||||
|
||||
|
||||
$result = @file_put_contents($this->_filename, $arrayString, $flags);
|
||||
|
||||
|
||||
if ($result === false) {
|
||||
require_once 'Zend/Config/Exception.php';
|
||||
throw new Zend_Config_Exception('Could not write to file "' . $this->_filename . '"');
|
||||
|
Reference in New Issue
Block a user