www/magento: update to 1.8.1 and more

Update to 1.8.1:
- Add additional patches issued post-release
- Stage support
- Removed option for MySQL patch now contained in the release
- Fix ./mage command by adding zlib to dependencies
- Closes ports/187985 (commit of 1.7 was incomplete)
- Adds option to support the REST Api.
- Adds option to activate redis session module (disabled by default).
- Rework cron.sh to do sane locking with lockf(1)
- Add example cron entry

PR:             ports/188901
Submitted by:   Melvyn Sopacua (maintainer)
Approved by:    maintainer (implicit), jadawin (mentor)
This commit is contained in:
Kurt Jaeger 2014-05-13 07:25:03 +00:00
parent 5f71ca1dbd
commit 482912a8a7
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=353923
10 changed files with 17039 additions and 43 deletions

View File

@ -2,61 +2,74 @@
# $FreeBSD$
PORTNAME= magento
PORTVERSION= 1.7.0.2
PORTVERSION= 1.8.1.0
CATEGORIES= www finance
MASTER_SITES= http://www.magentocommerce.com/downloads/assets/${PORTVERSION}/
MAINTAINER= mel@magemana.nl
MAINTAINER= melvyn@magemana.nl
COMMENT= Feature-rich eCommerce platform
USE_PHP= pdo_mysql hash gd iconv curl dom soap simplexml mcrypt mysql \
ctype
ctype zlib json
WRKSRC= ${WRKDIR}/magento
#OPTIONS_DEFINE= OAUTH SESSIONS REDIS SNAPPY EXAMPLES
OPTIONS_DEFINE= OAUTH SESSIONS REDIS EXAMPLES
OAUTH_DESC= Depend on pecl-oauth for REST API
SESSIONS_DESC= Mark Cm/RedisSession module active
REDIS_DESC= Depend on php5-redis for faster redis backend
#SNAPPY_DESC= Use google snappy for Redis Cache compression
OPTIONS_DEFINE= MYSQL56
MYSQL56_DESC= Add installer patch for MySQL 5.6 server
NO_BUILD= yes
MAGENTODIR?= www/magento
NO_STAGE= yes
.include <bsd.port.options.mk>
.if ${PORT_OPTIONS:MMYSQL56}
EXTRA_PATCHES= ${FILESDIR}/extra-patch-app__code__core__Mage__Install__Model__Installer__Db__Mysql4.php
.if !empty(${PORT_OPTIONS:MOAUTH})
RUN_DEPENDS+= pecl-oauth>=1.2.3:${PORTSDIR}/net/pecl-oauth
.endif
.if !empty(${PORT_OPTIONS:MREDIS})
RUN_DEPENDS+= php5-redis>=2.2.0:${PORTSDIR}/databases/php5-redis
.endif
# First need to submit the port
#.if ${PORT_OPTIONS:MSNAPPY}
#RUN_DEPENDS+= php5-snappy>=0.0.2:${PORTSDIR}/archivers/php5-snappy
#.endif
.include <bsd.port.pre.mk>
NO_BUILD= yes
PLIST= ${WRKDIR}/plist
SUB_FILES= pkg-message
SUB_LIST= MAGENTODIR=${MAGENTODIR}
WRITABLE= var media app/etc/modules
EXECUTABLE= cron.sh mage
SUB_FILES= pkg-message cron.sh pkg-install crontab
SUB_LIST+= MAGENTODIR=${MAGENTODIR} WWWOWN=${WWWOWN} WWWGRP=${WWWGRP}
PLIST_SUB+= ${SUB_LIST}
MAGENTODIR?= www/magento
pre-install:
@${FIND} -s -d ${WRKSRC} -type f | ${SED} "s?${WRKSRC}?${MAGENTODIR}?g" >${PLIST}
@${FIND} -s -d ${WRKSRC} -type d | ${SED} "s?${WRKSRC}?@dirrm ${MAGENTODIR}?g" >> ${PLIST}
@${ECHO} @dirrmtry ${MAGENTODIR} >> ${PLIST}
post-patch:
@${RM} -f ${WRKSRC}/cron.sh ${WRKSRC}/.htaccess
.ifdef MAINTAINER_MODE
genplist: extract patch
@${FIND} -s ${WRKSRC} -type f | ${SED} \
-e 's,${WRKSRC},%%MAGENTODIR%%,' > ${PORTSDIR}/www/magento/pkg-plist.new
@${FIND} -s -d ${WRKSRC} -type d | ${SED} \
-e 's,${WRKSRC}/media,@dirrmtry %%MAGENTODIR%%/media,' \
-e 's,${WRKSRC}/var,@dirrmtry %%MAGENTODIR%%/var,' \
-e 's,${WRKSRC},@dirrm %%MAGENTODIR%%,' >> ${PORTSDIR}/www/magento/pkg-plist.new
.endif
do-install:
@cd ${WRKSRC} && ${COPYTREE_SHARE} . ${PREFIX}/${MAGENTODIR}
.for _dir in ${WRITABLE}
@${CHOWN} -R ${WWWOWN}:${WWWGRP} ${PREFIX}/${MAGENTODIR}/${_dir}
@${FIND} ${PREFIX}/${MAGENTODIR}/${_dir} -exec ${CHMOD} u+w {} +
@${ECHO_CMD} '@exec ${CHOWN} -R ${WWWOWN}:${WWWGRP} ${PREFIX}/${MAGENTODIR}/${_dir}' \
>> ${TMPPLIST}
@${ECHO_CMD} '@exec ${FIND} ${PREFIX}/${MAGENTODIR}/${_dir} -exec ${CHMOD} u+w {} +' \
>> ${TMPPLIST}
.endfor
.for _prog in ${EXECUTABLE}
@${CHMOD} 555 ${PREFIX}/${MAGENTODIR}/${_prog}
@${ECHO_CMD} '@exec ${CHMOD} 555 ${PREFIX}/${MAGENTODIR}/${_prog}' >> ${PLIST}
.endfor
@${CHMOD} 777 ${PREFIX}/${MAGENTODIR}/app/etc
@${ECHO_CMD} '@exec ${CMMOD} 777 ${PREFIX}/${MAGENTODIR}/${_prog}' >> ${PLIST}
post-install:
@${CAT} ${PKGMESSAGE}
@cd ${WRKSRC} && ${COPYTREE_SHARE} . ${STAGEDIR}${PREFIX}/${MAGENTODIR}
@${INSTALL_SCRIPT} ${WRKDIR}/cron.sh ${STAGEDIR}${PREFIX}/${MAGENTODIR}
@${FIND} ${STAGEDIR}${PREFIX}/${MAGENTODIR}/var -type d \
-exec ${CHMOD} a+w {} +
@${CHMOD} a+x ${STAGEDIR}${PREFIX}/${MAGENTODIR}/app/etc \
${STAGEDIR}${PREFIX}/${MAGENTODIR}/app/etc/modules
.if !empty(${PORT_OPTIONS:MSESSIONS})
@${REINPLACE_CMD} -e 's,<active>false,<active>true,' \
${STAGEDIR}${PREFIX}/${MAGENTODIR}/app/etc/modules/Cm_RedisSession.xml
@${RM} -f ${STAGEDIR}${PREFIX}/${MAGENTODIR}/app/etc/modules/Cm_RedisSession.xml.bak
.endif
.if !empty(${PORT_OPIONS:MEXAMPLES})
@${MKDIR} ${STAGEDIR}${PREFIX}/${EXAMPLESDIR}
@${INSTALL_DATA} ${WRKDIR}/crontab ${STAGEDIR}${PREFIX}/${EXAMPLESDIR}
.endif
.include <bsd.port.post.mk>

View File

@ -1,2 +1,2 @@
SHA256 (magento-1.7.0.2.tar.gz) = d1cc07bc1ed59b3f33240e38d1fe3c60d03a03162c8fcb932700cf16a137e0b9
SIZE (magento-1.7.0.2.tar.gz) = 17891797
SHA256 (magento-1.8.1.0.tar.gz) = d2ec3c511b5936e242127789cdec9ae142bcacef8b636f2b2625fd8640e22aa1
SIZE (magento-1.8.1.0.tar.gz) = 18199920

View File

@ -0,0 +1,27 @@
#!/bin/sh
# Run this script if specified
if [ $# -gt 0 ]
then
CRONSCRIPT=$1
shift
else
CRONSCRIPT=cron.php
fi
# Pass argument on to cron.php
MODE=""
if [ $# -gt 0 ]
then
MODE="$1"
shift
fi
# PHP cli
PHP_BIN=`which php 2>/dev/null||echo %%PREFIX%%/bin/php`
# absolute path to magento installation
INSTALLDIR=`dirname $(realpath $0)`
# Only run if we're the only one running
[ -d ${INSTALLDIR}/var/locks ] || mkdir -p -m 777 ${INSTALLDIR}/var/locks
lockf -s -t 0 ${INSTALLDIR}/var/locks/cron.lock \
${PHP_BIN} -f ${INSTALLDIR}/${CRONSCRIPT} ${MODE}

View File

@ -0,0 +1,2 @@
# Add this line to /etc/crontab
*/5 * * * * %%WWWUSER%% %%PREFIX%%/%%MAGENTODIR%%/cron.sh

View File

@ -0,0 +1,71 @@
diff --git app/code/core/Mage/Payment/Model/Method/Cc.php app/code/core/Mage/Payment/Model/Method/Cc.php
index 4ee5bcd..a429744 100644
--- app/code/core/Mage/Payment/Model/Method/Cc.php
+++ app/code/core/Mage/Payment/Model/Method/Cc.php
@@ -105,6 +105,10 @@ class Mage_Payment_Model_Method_Cc extends Mage_Payment_Model_Method_Abstract
|| ($this->OtherCcType($info->getCcType()) && $this->validateCcNumOther($ccNumber))) {
$ccType = 'OT';
+ $discoverNetworkRegexp = '/^(30[0-5]\d{13}|3095\d{12}|35(2[8-9]\d{12}|[3-8]\d{13})|36\d{12}'
+ . '|3[8-9]\d{14}|6011(0\d{11}|[2-4]\d{11}|74\d{10}|7[7-9]\d{10}|8[6-9]\d{10}|9\d{11})'
+ . '|62(2(12[6-9]\d{10}|1[3-9]\d{11}|[2-8]\d{12}|9[0-1]\d{11}|92[0-5]\d{10})|[4-6]\d{13}'
+ . '|8[2-8]\d{12})|6(4[4-9]\d{13}|5\d{14}))$/';
$ccTypeRegExpList = array(
//Solo, Switch or Maestro. International safe
/*
@@ -115,21 +119,25 @@ class Mage_Payment_Model_Method_Cc extends Mage_Payment_Model_Method_Abstract
*/
// Solo only
'SO' => '/(^(6334)[5-9](\d{11}$|\d{13,14}$))|(^(6767)(\d{12}$|\d{14,15}$))/',
- 'SM' => '/(^(5[0678])\d{11,18}$)|(^(6[^05])\d{11,18}$)|(^(601)[^1]\d{9,16}$)|(^(6011)\d{9,11}$)'
- . '|(^(6011)\d{13,16}$)|(^(65)\d{11,13}$)|(^(65)\d{15,18}$)'
- . '|(^(49030)[2-9](\d{10}$|\d{12,13}$))|(^(49033)[5-9](\d{10}$|\d{12,13}$))'
- . '|(^(49110)[1-2](\d{10}$|\d{12,13}$))|(^(49117)[4-9](\d{10}$|\d{12,13}$))'
- . '|(^(49118)[0-2](\d{10}$|\d{12,13}$))|(^(4936)(\d{12}$|\d{14,15}$))/',
// Visa
'VI' => '/^4[0-9]{12}([0-9]{3})?$/',
// Master Card
'MC' => '/^5[1-5][0-9]{14}$/',
// American Express
'AE' => '/^3[47][0-9]{13}$/',
- // Discovery
- 'DI' => '/^6011[0-9]{12}$/',
- // JCB
- 'JCB' => '/^(3[0-9]{15}|(2131|1800)[0-9]{11})$/'
+ // Discover Network
+ 'DI' => $discoverNetworkRegexp,
+ // Dinners Club (Belongs to Discover Network)
+ 'DICL' => $discoverNetworkRegexp,
+ // JCB (Belongs to Discover Network)
+ 'JCB' => $discoverNetworkRegexp,
+
+ // Maestro & Switch
+ 'SM' => '/(^(5[0678])\d{11,18}$)|(^(6[^05])\d{11,18}$)|(^(601)[^1]\d{9,16}$)|(^(6011)\d{9,11}$)'
+ . '|(^(6011)\d{13,16}$)|(^(65)\d{11,13}$)|(^(65)\d{15,18}$)'
+ . '|(^(49030)[2-9](\d{10}$|\d{12,13}$))|(^(49033)[5-9](\d{10}$|\d{12,13}$))'
+ . '|(^(49110)[1-2](\d{10}$|\d{12,13}$))|(^(49117)[4-9](\d{10}$|\d{12,13}$))'
+ . '|(^(49118)[0-2](\d{10}$|\d{12,13}$))|(^(4936)(\d{12}$|\d{14,15}$))/'
);
foreach ($ccTypeRegExpList as $ccTypeMatch=>$ccTypeRegExp) {
diff --git js/prototype/validation.js js/prototype/validation.js
index a2dad07..700a472 100644
--- js/prototype/validation.js
+++ js/prototype/validation.js
@@ -850,11 +850,12 @@ function parseNumber(v)
Validation.creditCartTypes = $H({
// 'SS': [new RegExp('^((6759[0-9]{12})|(5018|5020|5038|6304|6759|6761|6763[0-9]{12,19})|(49[013][1356][0-9]{12})|(6333[0-9]{12})|(6334[0-4]\d{11})|(633110[0-9]{10})|(564182[0-9]{10}))([0-9]{2,3})?$'), new RegExp('^([0-9]{3}|[0-9]{4})?$'), true],
'SO': [new RegExp('^(6334[5-9]([0-9]{11}|[0-9]{13,14}))|(6767([0-9]{12}|[0-9]{14,15}))$'), new RegExp('^([0-9]{3}|[0-9]{4})?$'), true],
- 'SM': [new RegExp('(^(5[0678])[0-9]{11,18}$)|(^(6[^05])[0-9]{11,18}$)|(^(601)[^1][0-9]{9,16}$)|(^(6011)[0-9]{9,11}$)|(^(6011)[0-9]{13,16}$)|(^(65)[0-9]{11,13}$)|(^(65)[0-9]{15,18}$)|(^(49030)[2-9]([0-9]{10}$|[0-9]{12,13}$))|(^(49033)[5-9]([0-9]{10}$|[0-9]{12,13}$))|(^(49110)[1-2]([0-9]{10}$|[0-9]{12,13}$))|(^(49117)[4-9]([0-9]{10}$|[0-9]{12,13}$))|(^(49118)[0-2]([0-9]{10}$|[0-9]{12,13}$))|(^(4936)([0-9]{12}$|[0-9]{14,15}$))'), new RegExp('^([0-9]{3}|[0-9]{4})?$'), true],
'VI': [new RegExp('^4[0-9]{12}([0-9]{3})?$'), new RegExp('^[0-9]{3}$'), true],
'MC': [new RegExp('^5[1-5][0-9]{14}$'), new RegExp('^[0-9]{3}$'), true],
'AE': [new RegExp('^3[47][0-9]{13}$'), new RegExp('^[0-9]{4}$'), true],
- 'DI': [new RegExp('^6011[0-9]{12}$'), new RegExp('^[0-9]{3}$'), true],
- 'JCB': [new RegExp('^(3[0-9]{15}|(2131|1800)[0-9]{11})$'), new RegExp('^[0-9]{3,4}$'), true],
+ 'DI': [new RegExp('^(30[0-5][0-9]{13}|3095[0-9]{12}|35(2[8-9][0-9]{12}|[3-8][0-9]{13})|36[0-9]{12}|3[8-9][0-9]{14}|6011(0[0-9]{11}|[2-4][0-9]{11}|74[0-9]{10}|7[7-9][0-9]{10}|8[6-9][0-9]{10}|9[0-9]{11})|62(2(12[6-9][0-9]{10}|1[3-9][0-9]{11}|[2-8][0-9]{12}|9[0-1][0-9]{11}|92[0-5][0-9]{10})|[4-6][0-9]{13}|8[2-8][0-9]{12})|6(4[4-9][0-9]{13}|5[0-9]{14}))$'), new RegExp('^[0-9]{3}$'), true],
+ 'JCB': [new RegExp('^(30[0-5][0-9]{13}|3095[0-9]{12}|35(2[8-9][0-9]{12}|[3-8][0-9]{13})|36[0-9]{12}|3[8-9][0-9]{14}|6011(0[0-9]{11}|[2-4][0-9]{11}|74[0-9]{10}|7[7-9][0-9]{10}|8[6-9][0-9]{10}|9[0-9]{11})|62(2(12[6-9][0-9]{10}|1[3-9][0-9]{11}|[2-8][0-9]{12}|9[0-1][0-9]{11}|92[0-5][0-9]{10})|[4-6][0-9]{13}|8[2-8][0-9]{12})|6(4[4-9][0-9]{13}|5[0-9]{14}))$'), true],
+ 'DICL': [new RegExp('^(30[0-5][0-9]{13}|3095[0-9]{12}|35(2[8-9][0-9]{12}|[3-8][0-9]{13})|36[0-9]{12}|3[8-9][0-9]{14}|6011(0[0-9]{11}|[2-4][0-9]{11}|74[0-9]{10}|7[7-9][0-9]{10}|8[6-9][0-9]{10}|9[0-9]{11})|62(2(12[6-9][0-9]{10}|1[3-9][0-9]{11}|[2-8][0-9]{12}|9[0-1][0-9]{11}|92[0-5][0-9]{10})|[4-6][0-9]{13}|8[2-8][0-9]{12})|6(4[4-9][0-9]{13}|5[0-9]{14}))$'), new RegExp('^[0-9]{3}$'), true],
+ 'SM': [new RegExp('(^(5[0678])[0-9]{11,18}$)|(^(6[^05])[0-9]{11,18}$)|(^(601)[^1][0-9]{9,16}$)|(^(6011)[0-9]{9,11}$)|(^(6011)[0-9]{13,16}$)|(^(65)[0-9]{11,13}$)|(^(65)[0-9]{15,18}$)|(^(49030)[2-9]([0-9]{10}$|[0-9]{12,13}$))|(^(49033)[5-9]([0-9]{10}$|[0-9]{12,13}$))|(^(49110)[1-2]([0-9]{10}$|[0-9]{12,13}$))|(^(49117)[4-9]([0-9]{10}$|[0-9]{12,13}$))|(^(49118)[0-2]([0-9]{10}$|[0-9]{12,13}$))|(^(4936)([0-9]{12}$|[0-9]{14,15}$))'), new RegExp('^([0-9]{3}|[0-9]{4})?$'), true],
'OT': [false, new RegExp('^([0-9]{3}|[0-9]{4})?$'), false]
});

View File

@ -0,0 +1,226 @@
diff --git app/code/core/Mage/Catalog/Model/Product.php app/code/core/Mage/Catalog/Model/Product.php
index 3d538e2..7dcf307 100644
--- app/code/core/Mage/Catalog/Model/Product.php
+++ app/code/core/Mage/Catalog/Model/Product.php
@@ -1940,7 +1940,12 @@ class Mage_Catalog_Model_Product extends Mage_Catalog_Model_Abstract
/* add product custom options data */
$customOptions = $buyRequest->getOptions();
if (is_array($customOptions)) {
- $options->setOptions(array_diff($buyRequest->getOptions(), array('')));
+ foreach ($customOptions as $key => $value) {
+ if ($value === '') {
+ unset($customOptions[$key]);
+ }
+ }
+ $options->setOptions($customOptions);
}
/* add product type selected options data */
diff --git app/code/core/Mage/Core/Controller/Varien/Router/Standard.php app/code/core/Mage/Core/Controller/Varien/Router/Standard.php
index b2ebd4a..4500b24 100644
--- app/code/core/Mage/Core/Controller/Varien/Router/Standard.php
+++ app/code/core/Mage/Core/Controller/Varien/Router/Standard.php
@@ -43,7 +43,7 @@ class Mage_Core_Controller_Varien_Router_Standard extends Mage_Core_Controller_V
$modules = array((string)$routerConfig->args->module);
if ($routerConfig->args->modules) {
foreach ($routerConfig->args->modules->children() as $customModule) {
- if ($customModule) {
+ if ((string)$customModule) {
if ($before = $customModule->getAttribute('before')) {
$position = array_search($before, $modules);
if ($position === false) {
diff --git app/code/core/Zend/Pdf/FileParserDataSource.php app/code/core/Zend/Pdf/FileParserDataSource.php
new file mode 100644
index 0000000..df5b2c7
--- /dev/null
+++ app/code/core/Zend/Pdf/FileParserDataSource.php
@@ -0,0 +1,189 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Pdf
+ * @subpackage FileParser
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: FileParserDataSource.php 20096 2010-01-06 02:05:09Z bkarwin $
+ */
+
+/**
+ * Abstract helper class for {@link Zend_Pdf_FileParser} that provides the
+ * data source for parsing.
+ *
+ * Concrete subclasses allow for parsing of in-memory, filesystem, and other
+ * sources through a common API. These subclasses also take care of error
+ * handling and other mundane tasks.
+ *
+ * Subclasses must implement at minimum {@link __construct()},
+ * {@link __destruct()}, {@link readBytes()}, and {@link readAllBytes()}.
+ * Subclasses should also override {@link moveToOffset()} and
+ * {@link __toString()} as appropriate.
+ *
+ * @package Zend_Pdf
+ * @subpackage FileParser
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+abstract class Zend_Pdf_FileParserDataSource
+{
+ /**** Instance Variables ****/
+
+
+ /**
+ * Total size in bytes of the data source.
+ * @var integer
+ */
+ protected $_size = 0;
+
+ /**
+ * Byte offset of the current read position within the data source.
+ * @var integer
+ */
+ protected $_offset = 0;
+
+
+
+ /**** Public Interface ****/
+
+
+ /* Abstract Methods */
+
+ /**
+ * Object destructor. Closes the data source.
+ *
+ * May also perform cleanup tasks such as deleting temporary files.
+ */
+ abstract public function __destruct();
+
+ /**
+ * Returns the specified number of raw bytes from the data source at the
+ * byte offset of the current read position.
+ *
+ * Must advance the read position by the number of bytes read by updating
+ * $this->_offset.
+ *
+ * Throws an exception if there is insufficient data to completely fulfill
+ * the request or if an error occurs.
+ *
+ * @param integer $byteCount Number of bytes to read.
+ * @return string
+ * @throws Zend_Pdf_Exception
+ */
+ abstract public function readBytes($byteCount);
+
+ /**
+ * Returns the entire contents of the data source as a string.
+ *
+ * This method may be called at any time and so must preserve the byte
+ * offset of the read position, both through $this->_offset and whatever
+ * other additional pointers (such as the seek position of a file pointer)
+ * that might be used.
+ *
+ * @return string
+ */
+ abstract public function readAllBytes();
+
+
+ /* Object Magic Methods */
+
+ /**
+ * Returns a description of the object for debugging purposes.
+ *
+ * Subclasses should override this method to provide a more specific
+ * description of the actual object being represented.
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return get_class($this);
+ }
+
+
+ /* Accessors */
+
+ /**
+ * Returns the byte offset of the current read position within the data
+ * source.
+ *
+ * @return integer
+ */
+ public function getOffset()
+ {
+ return $this->_offset;
+ }
+
+ /**
+ * Returns the total size in bytes of the data source.
+ *
+ * @return integer
+ */
+ public function getSize()
+ {
+ return $this->_size;
+ }
+
+
+ /* Primitive Methods */
+
+ /**
+ * Moves the current read position to the specified byte offset.
+ *
+ * Throws an exception you attempt to move before the beginning or beyond
+ * the end of the data source.
+ *
+ * If a subclass needs to perform additional tasks (such as performing a
+ * fseek() on a filesystem source), it should do so after calling this
+ * parent method.
+ *
+ * @param integer $offset Destination byte offset.
+ * @throws Zend_Pdf_Exception
+ */
+ public function moveToOffset($offset)
+ {
+ if ($this->_offset == $offset) {
+ return; // Not moving; do nothing.
+ }
+ if ($offset < 0) {
+ #require_once 'Zend/Pdf/Exception.php';
+ throw new Zend_Pdf_Exception('Attempt to move before start of data source',
+ Zend_Pdf_Exception::MOVE_BEFORE_START_OF_FILE);
+ }
+ if ($offset >= $this->_size) { // Offsets are zero-based.
+ #require_once 'Zend/Pdf/Exception.php';
+ throw new Zend_Pdf_Exception('Attempt to move beyond end of data source',
+ Zend_Pdf_Exception::MOVE_BEYOND_END_OF_FILE);
+ }
+ $this->_offset = $offset;
+ }
+
+ /**
+ * Shifts the current read position within the data source by the specified
+ * number of bytes.
+ *
+ * You may move forward (positive numbers) or backward (negative numbers).
+ * Throws an exception you attempt to move before the beginning or beyond
+ * the end of the data source.
+ *
+ * @param integer $byteCount Number of bytes to skip.
+ * @throws Zend_Pdf_Exception
+ */
+ public function skipBytes($byteCount)
+ {
+ $this->moveToOffset($this->_offset + $byteCount);
+ }
+}

View File

@ -0,0 +1,64 @@
diff --git app/code/core/Mage/Cms/Helper/Wysiwyg/Images.php app/code/core/Mage/Cms/Helper/Wysiwyg/Images.php
index b106d09..0b6af65 100644
--- app/code/core/Mage/Cms/Helper/Wysiwyg/Images.php
+++ app/code/core/Mage/Cms/Helper/Wysiwyg/Images.php
@@ -49,6 +49,12 @@ class Mage_Cms_Helper_Wysiwyg_Images extends Mage_Core_Helper_Abstract
*/
protected $_storeId = null;
+ /**
+ * Images Storage root directory
+ * @var
+ */
+ protected $_storageRoot;
+
/**
* Set a specified store ID value
@@ -68,8 +74,13 @@ class Mage_Cms_Helper_Wysiwyg_Images extends Mage_Core_Helper_Abstract
*/
public function getStorageRoot()
{
- return Mage::getConfig()->getOptions()->getMediaDir() . DS . Mage_Cms_Model_Wysiwyg_Config::IMAGE_DIRECTORY
- . DS;
+ if (!$this->_storageRoot) {
+ $this->_storageRoot = realpath(
+ Mage::getConfig()->getOptions()->getMediaDir()
+ . DS . Mage_Cms_Model_Wysiwyg_Config::IMAGE_DIRECTORY
+ ) . DS;
+ }
+ return $this->_storageRoot;
}
/**
@@ -197,7 +208,7 @@ class Mage_Cms_Helper_Wysiwyg_Images extends Mage_Core_Helper_Abstract
public function getCurrentPath()
{
if (!$this->_currentPath) {
- $currentPath = realpath($this->getStorageRoot());
+ $currentPath = $this->getStorageRoot();
$node = $this->_getRequest()->getParam($this->getTreeNodeName());
if ($node) {
$path = realpath($this->convertIdToPath($node));
@@ -223,7 +234,7 @@ class Mage_Cms_Helper_Wysiwyg_Images extends Mage_Core_Helper_Abstract
public function getCurrentUrl()
{
if (!$this->_currentUrl) {
- $path = str_replace(Mage::getConfig()->getOptions()->getMediaDir(), '', $this->getCurrentPath());
+ $path = str_replace(realpath(Mage::getConfig()->getOptions()->getMediaDir()), '', $this->getCurrentPath());
$path = trim($path, DS);
$this->_currentUrl = Mage::app()->getStore($this->_storeId)->getBaseUrl('media') .
$this->convertPathToUrl($path) . '/';
diff --git app/code/core/Mage/Cms/Model/Wysiwyg/Images/Storage.php app/code/core/Mage/Cms/Model/Wysiwyg/Images/Storage.php
index 19b3f45..af58ce3 100644
--- app/code/core/Mage/Cms/Model/Wysiwyg/Images/Storage.php
+++ app/code/core/Mage/Cms/Model/Wysiwyg/Images/Storage.php
@@ -89,7 +89,7 @@ class Mage_Cms_Model_Wysiwyg_Images_Storage extends Varien_Object
foreach ($collection as $key => $value) {
$rootChildParts = explode(DIRECTORY_SEPARATOR, substr($value->getFilename(), $storageRootLength));
- if (array_key_exists($rootChildParts[0], $conditions['plain'])
+ if (array_key_exists(end($rootChildParts), $conditions['plain'])
|| ($regExp && preg_match($regExp, $value->getFilename()))) {
$collection->removeItemByKey($key);
}

View File

@ -0,0 +1,30 @@
#!/bin/sh
MAGENTODIR='%%MAGENTODIR%%'
var="${PKG_PREFIX}/${MAGENTODIR}/var"
WWWOWN="%%WWWOWN%%"
WWWGRP="%%WWWGRP%%"
medialist='media media/customer media/dhl media/downloadable media/xmlconnect'
medialist="${medialist} media/dhl/logo.jpg"
medialist="${medialist} media/downloadable/.htaccess"
medialist="${medialist} media/xmlconnect/custom/ok.gif"
medialist="${medialist} media/xmlconnect/original/ok.gif"
medialist="${medialist} media/xmlconnect/system/ok.gif"
if [ $2 = "POST-INSTALL" ]
then
find ${var} -type d -exec chmod 777 {} +
# var/cache should be world-writeable so that commandline tools like
# magerun do not create /tmp/magento/var/cache.
if [ -d ${var}/cache ]
then
find ${var}/cache -type f -exec chmod 666 {} +
fi
# Make no assumptions about what else is in the media directory, so
# only install our files and directories with correct ownership.
for entry in ${medialist}
do
chown ${WWWOWN}:${WWWGRP} ${PKG_PREFIX}/${MAGENTODIR}/${entry}
done
fi

View File

@ -1,4 +1,4 @@
POST-INSTALL CONFIGURATION FOR MOODLE
POST-INSTALL CONFIGURATION FOR MAGENTO
=====================================
1) Create a MySQL user and a database for Magento to store all
@ -19,8 +19,11 @@ POST-INSTALL CONFIGURATION FOR MOODLE
3) Visit your Magento site with a browser (i.e.,
http://your.server.com/magento/), and you should
be taken to the install.php script, which will lead
you through creating a config.php file and then
setting up Moodle, creating an admin account, etc.
you through creating the app/etc/local.xml file and then
setting up Magento, creating an admin account, etc.
4) After installation consider setting app/etc back to mode 755 for security
reasons.
For more information, see the INSTALL DOCUMENTATION:

16560
www/magento/pkg-plist Normal file

File diff suppressed because it is too large Load Diff