Overview

Packages

  • currencysymbol
  • MAbout
  • Mage
    • Admin
    • Adminhtml
    • AdminNotification
    • Api
    • Api2
    • Authorizenet
    • Backup
    • Bundle
    • Captcha
    • Catalog
    • CatalogIndex
    • CatalogInventory
    • CatalogRule
    • CatalogSearch
    • Centinel
    • Checkout
    • Cms
    • Compiler
    • Connect
    • Contacts
    • Core
    • Cron
    • CurrencySymbol
    • Customer
    • Dataflow
    • Directory
    • DirtectPost
    • Downloadable
    • Eav
    • GiftMessage
    • GoogleAnalytics
    • GoogleBase
    • GoogleCheckout
    • ImportExport
    • Index
    • Install
    • Log
    • Media
    • Newsletter
    • Oauth
    • Page
    • PageCache
    • Paygate
    • Payment
    • Paypal
    • PaypalUk
    • Persistent
    • Poll
    • ProductAlert
    • Rating
    • Reports
    • Review
    • Rss
    • Rule
    • Sales
    • SalesRule
    • Sedfriend
    • Sendfriend
    • Shipping
    • Sitemap
    • Tag
    • Tax
    • Usa
    • Weee
    • Widget
    • Wishlist
    • XmlConnect
  • None
  • Phoenix
    • Moneybookers
  • PHP
  • Zend
    • Date
    • Mime
    • XmlRpc

Classes

  • Mage_Backup_Exception
  • Mage_Backup_Helper_Data
  • Mage_Backup_Model_Backup
  • Mage_Backup_Model_Config_Backend_Cron
  • Mage_Backup_Model_Config_Source_Type
  • Mage_Backup_Model_Db
  • Mage_Backup_Model_Fs_Collection
  • Mage_Backup_Model_Mysql4_Db
  • Mage_Backup_Model_Observer
  • Mage_Backup_Model_Resource_Db
  • Mage_Backup_Model_Resource_Helper_Mysql4
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * Magento
 4:  *
 5:  * NOTICE OF LICENSE
 6:  *
 7:  * This source file is subject to the Open Software License (OSL 3.0)
 8:  * that is bundled with this package in the file LICENSE.txt.
 9:  * It is also available through the world-wide-web at this URL:
10:  * http://opensource.org/licenses/osl-3.0.php
11:  * If you did not receive a copy of the license and are unable to
12:  * obtain it through the world-wide-web, please send an email
13:  * to license@magentocommerce.com so we can send you a copy immediately.
14:  *
15:  * DISCLAIMER
16:  *
17:  * Do not edit or add to this file if you wish to upgrade Magento to newer
18:  * versions in the future. If you wish to customize Magento for your
19:  * needs please refer to http://www.magentocommerce.com for more information.
20:  *
21:  * @category    Mage
22:  * @package     Mage_Backup
23:  * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24:  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
25:  */
26: 
27: /**
28:  * Backup data collection
29:  *
30:  * @category   Mage
31:  * @package    Mage_Backup
32:  * @author      Magento Core Team <core@magentocommerce.com>
33:  */
34: class Mage_Backup_Model_Fs_Collection extends Varien_Data_Collection_Filesystem
35: {
36:     /**
37:      * Folder, where all backups are stored
38:      *
39:      * @var string
40:      */
41:     protected $_baseDir;
42: 
43:     /**
44:      * Set collection specific parameters and make sure backups folder will exist
45:      */
46:     public function __construct()
47:     {
48:         parent::__construct();
49: 
50:         $this->_baseDir = Mage::getBaseDir('var') . DS . 'backups';
51: 
52:         // check for valid base dir
53:         $ioProxy = new Varien_Io_File();
54:         $ioProxy->mkdir($this->_baseDir);
55:         if (!is_file($this->_baseDir . DS . '.htaccess')) {
56:             $ioProxy->open(array('path' => $this->_baseDir));
57:             $ioProxy->write('.htaccess', 'deny from all', 0644);
58:         }
59: 
60:         // set collection specific params
61:         $extensions = Mage::helper('backup')->getExtensions();
62: 
63:         foreach ($extensions as $key => $value) {
64:             $extensions[] = '(' . preg_quote($value, '/') . ')';
65:         }
66:         $extensions = implode('|', $extensions);
67: 
68:         $this
69:             ->setOrder('time', self::SORT_ORDER_DESC)
70:             ->addTargetDir($this->_baseDir)
71:             ->setFilesFilter('/^[a-z0-9\-\_]+\.' . $extensions . '$/')
72:             ->setCollectRecursively(false)
73:         ;
74:     }
75: 
76:     /**
77:      * Get backup-specific data from model for each row
78:      *
79:      * @param string $filename
80:      * @return array
81:      */
82:     protected function _generateRow($filename)
83:     {
84:         $row = parent::_generateRow($filename);
85:         foreach (Mage::getSingleton('backup/backup')->load($row['basename'], $this->_baseDir)
86:             ->getData() as $key => $value) {
87:             $row[$key] = $value;
88:         }
89:         $row['size'] = filesize($filename);
90:         $row['id'] = $row['time'] . '_' . $row['type'];
91:         return $row;
92:     }
93: }
94: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0