MaMo Net



#1 05.12.2006, 10:09
MaMo Abwesend
Administrator
Dabei seit: 06.04.2004
Beiträge: 2.675


Betreff: Viscacha 0.9 / Derzeit kein Support möglich [Update]
Nachträgliche Anmerkung des Autors:
Mein internetzugang ist wieder freigeschaltet, es kann also wie gewohnt Support erfolgen.

Die Arbeiten an Viscacha 0.9 haben begonnen. Der OOP-Kern ist im Aufbau und die Doku ist auch enthalten.

Nachträgliche Anmerkung des Autors:

Hier mal die Grundsteine. Wie man sieht benötigt Viscacha ab Version 0.9 PHP 5 oder höher.

class.Viscacha.php
DownloadPHP-Quelltext:
  1. <?php
  2. /**
  3.  *      Viscacha - A bulletin board solution for easily managing your content
  4.  *      Copyright (C) 2004-2007  Viscacha.org
  5.  *
  6.  *      This program is free software; you can redistribute it and/or modify
  7.  *      it under the terms of the GNU General Public License as published by
  8.  *      the Free Software Foundation; either version 2 of the License, or
  9.  *      (at your option) any later version.
  10.  *
  11.  *      This program is distributed in the hope that it will be useful,
  12.  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  *      GNU General Public License for more details.
  15.  *
  16.  *      You should have received a copy of the GNU General Public License
  17.  *      along with this program; if not, write to the Free Software
  18.  *      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  19.  *
  20.  * @package             Viscacha
  21.  * @author              Matthias Mohr
  22.  * @copyright   (C) 2004-2007, Viscacha.org
  23.  * @since               0.9
  24.  */
  25.  
  26. class Viscacha {
  27.  
  28.         private static $instances;
  29.         protected static $dbal;
  30.  
  31.         /**
  32.          * Wow, construct a new Viscacha ;-)
  33.          **/
  34.         public function __construct() {
  35.                 self::$instances = array();
  36.                 self::dbalConfig(); // Set the constant DBAL
  37.         }
  38.  
  39.         /**
  40.          * Main function. This function will be called.
  41.          *
  42.          * This function has to be implemented in the subclasses.
  43.          **/
  44.         public function main(){
  45.                 self::internalError("You have not defined method 'main' in subclass", E_USER_ERROR);
  46.         }
  47.  
  48.         /**
  49.          * Gets an instance of an object with the name passed as parameter.
  50.          *
  51.          * If no instance is constructed yet, a new instance will be created.
  52.          * To create a new instance the class is loaded from the source folder.
  53.          * On failure null will be returned.
  54.          *
  55.          * Example:
  56.          * To load the mysql-class in the folder dbal use this name: dbal.mysql
  57.          *
  58.          * @param string Name of Package
  59.          * @return object Returns the object or null on failure
  60.          **/
  61.         public static function getObject($objectName) {
  62.                 $parts = explode('.', $objectName);
  63.                 $className = array_pop($parts);
  64.                 if (!isset(self::$instances[$objectName]) || !is_object(self::$instances[$objectName])) {
  65.                         self::loadClass($objectName);
  66.                         if (class_exists($className) == true) {
  67.                                 self::$instances[$objectName] = new $className();
  68.                         }
  69.                         else {
  70.                                 self::internalError("Can not find class with name '{$className}'");
  71.                                 return null;
  72.                         }
  73.                 }
  74.                 return self::$instances[$objectName];
  75.         }
  76.  
  77.         /**
  78.          * Updates or sets an instance of an object.
  79.          *
  80.          * On failure the object will not be set.
  81.          *
  82.          * @param string Name of Package
  83.          * @param object Object to add
  84.          **/
  85.         public static function updateObject($objectName, $object){
  86.                 if (!is_object($object)) {
  87.                         self::internalError("Argument #2 of method updateInstance has to be an object.");
  88.                 }
  89.                 else {
  90.                         self::$instances[$objectName] = $object;
  91.                 }
  92.         }
  93.  
  94.         /**
  95.          * Loads a class from the filesystem that can be used afterwards.
  96.          *
  97.          * On failure the object will not be loaded.
  98.          *
  99.          * @param string Name of Package
  100.          **/
  101.         public static function loadClass($class){
  102.                 $class = strtolower($class);
  103.                 $classData = explode('.', $class);
  104.                 array_unshift($classData, 'source');
  105.                 $className = array_pop($classData);
  106.                 $folders = implode('/', $classData);
  107.                 $file = "{$folders}/class.{$className}.php";
  108.                 if (file_exists($file) == false) {
  109.                         self::internalError("Can not find class source file '{$class}' at {$file}");
  110.                 }
  111.                 else {
  112.                         include_once($file);
  113.                 }
  114.         }
  115.  
  116.         /**
  117.          * Loads a interface from the filesystem that can be used afterwards.
  118.          *
  119.          * On failure the interface will not be loaded and the script will be aborted with an USER_ERROR.
  120.          *
  121.          * @param string Name of Package/Interface
  122.          **/
  123.         public static function loadInterface($interface){
  124.                 $interface = strtolower($interface);
  125.                 $interfaceData = explode('.', $interface);
  126.                 array_unshift($interfaceData, 'source');
  127.                 $interfaceName = array_pop($interfaceData);
  128.                 $folders = implode('/', $interfaceData);
  129.                 $file = "{$folders}/interface.{$interfaceName}.php";
  130.                 if (file_exists($file) == false) {
  131.                         self::internalError("Can not find interface source file '{$interface}' at {$file}", E_USER_ERROR);
  132.                 }
  133.                 else {
  134.                         require_once($file);
  135.                 }
  136.         }
  137.  
  138.         /**
  139.          * Triggers an error message.
  140.          *
  141.          * The first parameter can not be longer than 1024 chars.
  142.          * The constants E_USER_ERROR (256), E_USER_WARNING (512) and E_USER_NOTICE (1024) can be used for the second parameter.
  143.          * Default value for the second parameter is E_WARNING (512).
  144.          *
  145.          * @param string Error message
  146.          * @param int Error reporting level
  147.          * @see http://www.php.net/error_reporting
  148.          **/
  149.         protected static function internalError($error, $warning = E_USER_WARNING){
  150.                 trigger_error($error, $warning);
  151.         }
  152.  
  153.         /**
  154.          * Returns an array containing the database connection data.
  155.          *
  156.          * @return array Configuration (for database) from file data/config.php
  157.          **/
  158.         public static function dbalConfig() {
  159.                 if (is_array(self::$dbal) == false) {
  160.                         require_once('data/config.php');
  161.                         if ($config['installed'] == false) {
  162.                                 self::internalError("Viscacha is not installed. Please install it using the installer!", E_USER_ERROR);
  163.                         }
  164.                         if (defined('DBAL') == false) {
  165.                                 define('DBAL', "dbal.{$config['system']}");
  166.                         }
  167.                         self::$dbal = $config;
  168.                 }
  169.                 return self::$dbal;
  170.         }
  171.  
  172. }
  173. ?>

modules/class.Sample.php
DownloadPHP-Quelltext:
  1. <?php
  2. /**
  3.  *      Viscacha - A bulletin board solution for easily managing your content
  4.  *      Copyright (C) 2004-2007  Viscacha.org
  5.  *
  6.  *      This program is free software; you can redistribute it and/or modify
  7.  *      it under the terms of the GNU General Public License as published by
  8.  *      the Free Software Foundation; either version 2 of the License, or
  9.  *      (at your option) any later version.
  10.  *
  11.  *      This program is distributed in the hope that it will be useful,
  12.  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  *      GNU General Public License for more details.
  15.  *
  16.  *      You should have received a copy of the GNU General Public License
  17.  *      along with this program; if not, write to the Free Software
  18.  *      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  19.  *
  20.  * @package             Viscacha
  21.  * @subpackage  Sample
  22.  * @author              Matthias Mohr
  23.  * @copyright   (C) 2004-2007, Viscacha.org
  24.  * @since               0.9
  25.  */
  26.  
  27. class Sample extends Viscacha {
  28.  
  29.         /**
  30.          * Shows Pages: Default, 1 and 2...
  31.          **/
  32.         public function main(){
  33.                 $vars = $this->getObject('validate.Variables');
  34.                 $action = $vars->get('action', VAR_ALNUM);
  35.                 switch($action) {
  36.                         case 'p1':
  37.                                 $this->page1();
  38.                                 break;
  39.                         case 'p2':
  40.                                 $this->page2();
  41.                                 break;
  42.                         case 'p3':
  43.                                 $this->page3();
  44.                                 break;
  45.                         default:
  46.                                 $this->page_default();
  47.                                 break;
  48.                 }
  49.         }
  50.  
  51.         /**
  52.          * Shows default page
  53.          **/
  54.         public function page_default(){
  55.                 ?>
  56.                 Default Page!<br /><br />
  57.                 <b>Select:</b>
  58.                 <ul>
  59.                 <li><a href='index.php?action=p1'>Page One (with native DBAL)</a></li>
  60.                 <li><a href='index.php?action=p2'>Page Two (with ADODB Lite)</a></li>
  61.                 <li><a href='index.php?action=p3'>Page Three (Error Handling)</a></li>
  62.                 </ul><?php
  63.         }
  64.  
  65.         /**
  66.          * Page 1
  67.          **/
  68.         public function page1(){
  69.                 echo "Page One!";
  70.                 $cache = $this->getObject('cache.CacheServer');
  71.                 $test = $cache->load('test');
  72.                 echo "<br />Datenbank-System: ".$test->get();
  73.                 echo "<hr />";
  74.                 $db = Viscacha::getObject(DBAL);
  75.                 $db->query("SELECT * FROM {$db->pre}user", __LINE__, __FILE__);
  76.                 $rows = $db->fetchAll();
  77.                 print_r($rows);
  78.         }
  79.  
  80.         /**
  81.          * Page 2
  82.          **/
  83.         public function page2(){
  84.                 echo "Page Two!";
  85.         }
  86.  
  87.         /**
  88.          * Page 3
  89.          **/
  90.         public function page3(){
  91.                 $this->internalError("Page Three!", E_USER_ERROR);
  92.         }
  93.  
  94. }
  95. ?>

dbal/interface.dbal.php
DownloadPHP-Quelltext:
  1. <?php
  2. /**
  3.  *      Viscacha - A bulletin board solution for easily managing your content
  4.  *      Copyright (C) 2004-2007  Viscacha.org
  5.  *
  6.  *      This program is free software; you can redistribute it and/or modify
  7.  *      it under the terms of the GNU General Public License as published by
  8.  *      the Free Software Foundation; either version 2 of the License, or
  9.  *      (at your option) any later version.
  10.  *
  11.  *      This program is distributed in the hope that it will be useful,
  12.  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  *      GNU General Public License for more details.
  15.  *
  16.  *      You should have received a copy of the GNU General Public License
  17.  *      along with this program; if not, write to the Free Software
  18.  *      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  19.  *
  20.  * @package             Viscacha
  21.  * @subpackage  DBAL
  22.  * @author              Matthias Mohr
  23.  * @copyright   (C) 2004-2007, Viscacha.org
  24.  * @since               0.9
  25.  */
  26.  
  27. interface dbal {
  28.  
  29.         /**
  30.          * Returns the number of rows affected by the last INSERT, UPDATE, or DELETE query.
  31.          *
  32.          * If the last query was invalid, this function will return -1.
  33.          *
  34.          * @return int Affected rows by the last query
  35.          **/
  36.         public function affectedRows();
  37.  
  38.         /**
  39.          * Returns a complete backup.
  40.          *
  41.          * The returned backup can be restored with the restore function.
  42.          * You can specify what you want to export:
  43.          * Structure: CREATE TABLE,
  44.          * Data: INSERT INTO,
  45.          * Delete statement: DROP TABLE IF EXISTS
  46.          *
  47.          * @param array Tables to export
  48.          * @param boolean Export structure of tables
  49.          * @param boolean Export data of tables
  50.          * @param boolean Add drop (delete) statements
  51.          * @return string Backup if tables
  52.          **/
  53.         public function backup($tables, $structure = true, $data = true, $drop = true);
  54.  
  55.         /**
  56.          * Returns an array with benchmark infotmation.
  57.          *
  58.          * Structure of the array:
  59.          * time => time alle queries took
  60.          * count => number of queries that were executed
  61.          * queries => array with all queries and the time they took (Keys: time and query)
  62.          *
  63.          * @return array Array with benchmark information
  64.          **/
  65.         public function benchmark();
  66.  
  67.  
  68.         /**
  69.          * Attempts to open a connection to the MySQL Server.
  70.          *
  71.          * The host can be either a host name or an IP address. Passing the null value or the
  72.          * string "localhost" to this parameter, the local host is assumed. If successful,
  73.          * the the function will return an object representing the connection to the database,
  74.          * or null on failure. The port and socket parameters are used in conjunction with the
  75.          * host parameter to further control how to connect to the database server. The port
  76.          * parameter specifies the port number to attempt to connect to the MySQL server on,
  77.          * while the socket parameter specifies the socket or named pipe that should be used.
  78.          * If all values are null, the data from the configuration file will be read and used.
  79.          * If one value is not null, the data specified will be used. Default values are in this
  80.          * case:
  81.          * Host: localhost,
  82.          * Username: root
  83.          * Password: <empty> (An warning will occur)
  84.          * Database: <empty> (No database will be selected)
  85.          * Port: 3306
  86.          * Persistent: false
  87.          * Socket: null
  88.          *
  89.          * The persistent parameter is experimental at the moment!
  90.          *
  91.          * @param string Host
  92.          * @param string Username
  93.          * @param string Passwort
  94.          * @param string Database name
  95.          * @param int Port
  96.          * @param string Socket or null
  97.          * @param boolean Persistent connection
  98.          * @return
  99.          **/
  100.         public function connect($username = null, $password = null, $host = null, $database = null, $port = null, $socket = null, $persistent = null);
  101.  
  102.         /**
  103.          * Closes a previously opened database connection.
  104.          *
  105.          * @return boolean true on success, false on failure
  106.          **/
  107.         public function disconnect();
  108.  
  109.         /**
  110.          * Handles an SQL Error.
  111.          *
  112.          * The first parameter can not be longer than 1024 chars.
  113.          * The constants E_USER_ERROR (256), E_USER_WARNING (512) and E_USER_NOTICE (1024) can be used for the second parameter.
  114.          * Default value for the second parameter is E_WARNING (512).
  115.          *
  116.          * @param int Error reporting level
  117.          * @param string Error message
  118.          * @param int Line number
  119.          * @param string Filename
  120.          * @param string (Last) Query
  121.          * @see http://www.php.net/error_reporting
  122.          **/
  123.         public function sqlError($warning = E_USER_ERROR, $error = null, $line = null, $file = null, $query = null);
  124.  
  125.         /**
  126.          * Returns an internal error message for the last error.
  127.          *
  128.          * @return string Error message
  129.          **/
  130.         public function error();
  131.  
  132.         /**
  133.          * Returns an internal error number for the last error.
  134.          *
  135.          * @return int Error number
  136.          **/
  137.         public function errno();
  138.  
  139.         /**
  140.          * Escapes special characters in a string for use in a SQL statement.
  141.          *
  142.          * You can either specify an string to be escaped or an array.
  143.          * Each array element will be escaped recursively.
  144.          *
  145.          * @param mixed String or array to escape
  146.          * @return mixed Escaped string or array
  147.          **/
  148.         public function escapeString($data);
  149.  
  150.  
  151.         /**
  152.          * Fetch all result rows as a multidimensional associative array.
  153.          *
  154.          * Each first level element contains an associative array that corresponds to the fetched row.
  155.          * The keys of the first level array can be set to the values of a field from the received result rows.
  156.          * If no key is specified, the array will be an enumerated array, where each column
  157.          * is stored in an array offset starting from 0 (zero).
  158.          *
  159.          * @param resource Result set
  160.          * @param string Field to use for the keys or null to get an enumerated array
  161.          * @return
  162.          **/
  163.         public function fetchAll($result = null, $key = null);
  164.  
  165.  
  166.         /**
  167.          * Fetches the first result row and returns the first field in this row.
  168.          *
  169.          * A result set (resource) already returned by a query() or a query (string) that will be
  170.          * executed can be specified. The second and the third parameter is only needed when a
  171.          * query (string) is specified. In the other case it is ignored.
  172.          *
  173.          * @param mixed Result set (resource) or query (string)
  174.          * @param int Line number
  175.          * @param string Filename
  176.          * @return mixed First field in first row
  177.          **/
  178.         public function fetchOne($result = null, $line = null, $file = null);
  179.  
  180.         /**
  181.          * Fetch a result row as an associative array
  182.          *
  183.          * Returns an associative array that corresponds to the fetched row or null if there are no more rows.
  184.          * The function is used to return an associative array representing the next row in the result set for
  185.          * the result represented by the result parameter, where each key in the array represents the name of
  186.          * one of the result set's columns. If two or more columns of the result have the same field names,
  187.          * the last column will take precedence. To access the other column(s) of the same name, you either
  188.          * need to access the result with numeric indices by using fetchNum() or add alias names.
  189.          *
  190.          * @param mixed $result
  191.          * @return
  192.          **/
  193.         public function fetchAssoc($result = null);
  194.  
  195.         /**
  196.          * Get a result row as an enumerated array.
  197.          *
  198.          * Fetches one row of data from the result set represented by result and returns it as an enumerated array,
  199.          * where each column is stored in an array offset starting from 0 (zero). Each subsequent call to the
  200.          * function will return the next row within the result set, or null if there are no more rows.
  201.          *
  202.          * @param resource Result set
  203.          * @return array Enumerated array or null
  204.          **/
  205.         public function fetchNum($result = null);
  206.  
  207.         /**
  208.          * Returns the current row of a result set as an object.
  209.          *
  210.          * Returns the current row result set as an object where the attributes of the object represent the names
  211.          * of the fields found within the result set. If no more rows exist in the current result set, null is returned.
  212.          * If two or more columns of the result have the same field names, the last column will take precedence.
  213.          *
  214.          * @param resource Result set
  215.          * @return object Object or null
  216.          **/
  217.         public function fetchObject($result = null);
  218.  
  219.         /**
  220.          * Frees the memory associated with a result.
  221.          *
  222.          * @param resource Result set
  223.          **/
  224.         public function freeResults($result = null);
  225.  
  226.         /**
  227.          * Returns the ID used in the last INSERT query.
  228.          *
  229.          * null is returned on failure or when there was no last INSERT query.
  230.          *
  231.          * @return int ID or null
  232.          **/
  233.         public function insertID();
  234.  
  235.         /**
  236.          * Returns an array containing all fields of the specified table.
  237.          *
  238.          * If no database is specified, the database will be read from the configuration file.
  239.          *
  240.          * @param string Table
  241.          * @param string Database or null
  242.          * @return array Array containing all fields of a table
  243.          **/
  244.         public function listFields($table, $database = null);
  245.  
  246.         /**
  247.          * Returns an array containing all tables of the specified database.
  248.          *
  249.          * If no database is specified, the database will be read from the configuration file.
  250.          *
  251.          * @param string Database or null
  252.          * @return array Array containing all tables of a database
  253.          **/
  254.         public function listTables($database = null);
  255.  
  256.         /**
  257.          * Check if there are any more query results from the last multi query.
  258.          *
  259.          * Each query is one result.
  260.          *
  261.          * @return boolean true if there are more results, false in the other case
  262.          **/
  263.         public function moreResults();
  264.  
  265.         /**
  266.          * Performs one ore more queries on the database.
  267.          *
  268.          * Executes one or multiple queries which are concatenated by a semicolon. All
  269.          * subsequent query results can be processed using moreResults() and nextResult().
  270.          *
  271.          * @param mixed Queries
  272.          * @param int Line number
  273.          * @param string Filename
  274.          **/
  275.         public function multiQuery($query, $line = null, $file = null);
  276.  
  277.         /**
  278.          * Returns the next result as an associative array from the last multi_query.
  279.          *
  280.          * Each query is one result. All result rows will be returned as a multidimensional associative array.
  281.          *
  282.          * @return array Multidimensional associative array
  283.          **/
  284.         public function nextResult();
  285.  
  286.         /**
  287.          * Gets the number of rows in a result.
  288.          *
  289.          * The use depends on whether you use buffered or unbuffered result sets.
  290.          * In case you use unbuffered resultsets this function will not correct the
  291.          * correct number of rows until all the rows in the result have been retrieved.
  292.          *
  293.          * @param resource Result set
  294.          * @return int Number of rows
  295.          **/
  296.         public function numRows($result = null);
  297.  
  298.         /**
  299.          * Returns the prefix of the tables.
  300.          *
  301.          * @return string Prefix
  302.          **/
  303.         public function prefix();
  304.  
  305.         /**
  306.          * Performs a query on the database.
  307.          *
  308.          * @param string Single Query
  309.          * @param int Line number
  310.          * @param string Filename
  311.          * @param boolean Set this to true to perform an unbuffered query
  312.          * @return mixed Result set for a select statement, a boolean for other statements (true on success, false on failure), null for an unbuffered query.
  313.          **/
  314.         public function query($query, $line = null, $file = null, $unbuffered = false);
  315.  
  316.         /**
  317.          * Adjusts the result pointer to the first row in the result set.
  318.          *
  319.          * @param resource Result set
  320.          * @return boolean Returns true on success, false on failure
  321.          **/
  322.         public function resetResult($result = null);
  323.  
  324.         /**
  325.          * Restores a backup made with the backup function.
  326.          *
  327.          * @param string Backup
  328.          **/
  329.         public function restore($backup);
  330.  
  331.         /**
  332.          * Selects the default database to be used when performing queries against the database connection.
  333.          *
  334.          * @param string Database or null (database is read from configuration file)
  335.          * @return boolean true on success, false on failure
  336.          **/
  337.         public function selectDB($database = null);
  338.  
  339.         /**
  340.          * Returns a string containing which database system (database abstraction layer) is used.
  341.          *
  342.          * @return string Database System
  343.          **/
  344.         public function system();
  345.  
  346.         /**
  347.          * Performs an unbuffered query on the database.
  348.          *
  349.          * This is an alias/short form for calling query() with the fourth paramater set to true.
  350.          *
  351.          * @param string Single query
  352.          * @param int Line number
  353.          * @param string Filename
  354.          * @return
  355.          **/
  356.         public function unbufferedQuery($query, $line = null, $file = null);
  357.  
  358.         /**
  359.          * Returns a string representing the version of the database server.
  360.          *
  361.          * @return string Version
  362.          **/
  363.         public function version();
  364.  
  365. }
  366. ?>

cache/class.CacheServer.php
DownloadPHP-Quelltext:
  1. <?php
  2. /**
  3.  *      Viscacha - A bulletin board solution for easily managing your content
  4.  *      Copyright (C) 2004-2007  Viscacha.org
  5.  *
  6.  *      This program is free software; you can redistribute it and/or modify
  7.  *      it under the terms of the GNU General Public License as published by
  8.  *      the Free Software Foundation; either version 2 of the License, or
  9.  *      (at your option) any later version.
  10.  *
  11.  *      This program is distributed in the hope that it will be useful,
  12.  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  *      GNU General Public License for more details.
  15.  *
  16.  *      You should have received a copy of the GNU General Public License
  17.  *      along with this program; if not, write to the Free Software
  18.  *      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  19.  *
  20.  * @package             Viscacha
  21.  * @subpackage  Cache
  22.  * @author              Matthias Mohr
  23.  * @copyright   (C) 2004-2007, Viscacha.org
  24.  * @since               0.9
  25.  */
  26.  
  27. Viscacha::loadClass('cache.CacheItem');
  28.  
  29. class CacheServer {
  30.  
  31.         private $cachedir;
  32.         private $data;
  33.  
  34.         /**
  35.          * Constructs a new Cache Manager. In this class all loaded CacheItems will be cached.
  36.          *
  37.          * @param string Path to cache folder
  38.          **/
  39.         public function __construct($cachedir = 'data/cache/') {
  40.                 $this->cachedir = $cachedir;
  41.                 $this->data = array();
  42.         }
  43.  
  44.         /**
  45.          * This method loads a cache item and adds it to the cache manager.
  46.          *
  47.          * If the cache class file is not found or the cache file is corrupt a new
  48.          * CacheItem will be constructed. An USER_NOTICE will be thrown.
  49.          *
  50.          * @param string Name of the cache file (class.cache_ will be added before the name and .php will be added after the name)
  51.          * @param string Path to the folder with the cache files
  52.          * @return object
  53.          **/
  54.         public function load($name, $sourcedir = 'source/cache/items/') {
  55.                 $className = "cache_{$name}";
  56.                 $fileName = "class.{$className}.php";
  57.                 $classPath = $sourcedir.$fileName;
  58.                 $dataPath = $this->cachedir.$name.'.cache';
  59.  
  60.                 if (class_exists($className) == false) {
  61.                         if (file_exists($classPath) == true) {
  62.                                 include($classPath);
  63.                         }
  64.                         else {
  65.                                 $this->error("Can not load cache file {$classPath}");
  66.                         }
  67.                 }
  68.  
  69.                 if (class_exists($className) == true) {
  70.                         $object = new $className($dataPath);
  71.                 }
  72.                 else {
  73.                         $this->error("Can not initialize cache class of type {$className}");
  74.                         $object = new CacheItem($dataPath);
  75.                 }
  76.  
  77.                 $this->data[$name] = $object;
  78.                 return $object;
  79.         }
  80.  
  81.         /**
  82.          * This method removes a cache item from the cache manager.
  83.          *
  84.          * If the cache manager has no cache item with the specified name nothing will be done.
  85.          *
  86.          * @param string Name of the cache file
  87.          **/
  88.         public function unload($name) {
  89.                 if (isset($this->data[$name]) == true) {
  90.                         unset($this->data[$name]);
  91.                 }
  92.         }
  93.  
  94.         /**
  95.          * Triggers an error message.
  96.          *
  97.          * The first parameter can not be longer than 1024 chars.
  98.          * The constants E_USER_ERROR (256), E_USER_WARNING (512) and E_USER_NOTICE (1024) can be used for the second parameter.
  99.          * Default value for the second parameter is E_WARNING (512).
  100.          *
  101.          * @param string Error message
  102.          * @param int Error reporting level
  103.          * @see http://www.php.net/error_reporting
  104.          **/
  105.         private function error($error, $warning = E_USER_NOTICE){
  106.                 trigger_error($error, $warning);
  107.         }
  108. }
  109. ?>

Fortsetzung folgt...

Matthias M.
=> Support nur per Forum - dann haben alle etwas davon!
Dieser Beitrag wurde 2 mal editiert, das letzte Mal am 06.12.2006, 23:21 von MaMo. ↑  ↓

#2 05.12.2006, 14:53
Der fette Mo Abwesend
Viscacha 0.9 Team
Dabei seit: 21.08.2006
Beiträge: 105


Betreff: Re: Derzeit kein Support möglich
Zitat von MaMo:
PS: Die Arbeiten an Viscacha 0.9 haben begonnen. Der OOP-Kern steht und die Doku ist auch enthalten. Ich poste demnächst mal einige der Grundklassen :-) Ich denke der Code wird gefallen...

Gut dass du das sagst bevor ich mir Gedanken gemacht habe... Undecided
SGN/1.0
Server: Moritz B./15.11.90
Location: Friedberg (BY)
Content-Language: de-by
X-Please-Bookmark: http://www.diplomtrottel.de
Connection: keep-alive
↑  ↓

#3 05.12.2006, 15:37
MaMo Abwesend
Administrator
Dabei seit: 06.04.2004
Beiträge: 2.675


Betreff: Re: Derzeit kein Support möglich
Soo... ein wenig Druck gemacht und auf einmal bekommt man doch seine Daten Smiling

Nun mit Kern sind eher so kleinere Experimente gemeint, nichts Großes - wir haben also noch alle Möglichkeiten Smiling Schreib mich mal an, dann können wir uns deswegen evrständigen.
Matthias M.
=> Support nur per Forum - dann haben alle etwas davon!
↑  ↓

#4 06.12.2006, 23:22
MaMo Abwesend
Administrator
Dabei seit: 06.04.2004
Beiträge: 2.675


Betreff: Re: Viscacha 0.9 / Derzeit kein Support möglich [Update]
Beitrag oben wurde aktualisiert...
Matthias M.
=> Support nur per Forum - dann haben alle etwas davon!
↑  ↓

#5 07.01.2007, 20:19
michi50 Abwesend
Mitglied
Dabei seit: 02.01.2006
Beiträge: 6


Betreff: Re: Viscacha 0.9 / Derzeit kein Support möglich [Update]
Viel Glück mit der neuen Version von Viscacha.
↑  ↓

#6 15.02.2007, 20:24
MaMo Abwesend
Administrator
Dabei seit: 06.04.2004
Beiträge: 2.675


Betreff: Re: Viscacha 0.9 / Derzeit kein Support möglich [Update]
Hier findet Ihr eine Beispiel-API wie sie in 0.9 zur Verfügung stehen wird... http://www.mamo-net.de/showtopic.php?id=956 Smiling
Matthias M.
=> Support nur per Forum - dann haben alle etwas davon!
↑  ↓

#7 26.02.2007, 01:30
Anna Abwesend
Mitglied
Dabei seit: 20.08.2006
Beiträge: 10


Betreff: Re: Viscacha 0.9 / Derzeit kein Support möglich [Update]
Gibt es denn mittlerweile irgendwelche Neuigkeiten bezüglich 0.8 (am Bugtracker passiert nichts) und der 0.9?
Mich würde vor allem immernoch interessieren, wann wir mit einer Beta der 0.9 rechnen können, und ob die 0.8 Final (und vor allem, was fehlt noch bis zur RC2-Testphase) noch davor erscheinen soll/wird...
Riesen Respekt für deine Arbeit, aber halte uns doch auch weiterhin bitte auf dem Laufenden MaMo
Gruß und gute Nacht,
Anna
↑  ↓

#8 26.02.2007, 17:45
Der fette Mo Abwesend
Viscacha 0.9 Team
Dabei seit: 21.08.2006
Beiträge: 105


Betreff: Re: Viscacha 0.9 / Derzeit kein Support möglich [Update]
Hi.

Zitat von Anna:
Mich würde vor allem immernoch interessieren, wann wir mit einer Beta der 0.9 rechnen können, und ob die 0.8 Final (und vor allem, was fehlt noch bis zur RC2-Testphase) noch davor erscheinen soll/wird...

Die Final wird mich Sicherheit noch davor erscheinen, so viel steht fest. Die 0.9 steht noch in den Sternen, wir sind im Moment noch am Ideen und Klassen sammeln.

Für die RC2 wird immer noch auf Bugreports und kleinere Verbesserungsvorschläge gewartet. Vor Allem fehlt MaMo aber im Moment die Zeit Wink

Gruß
SGN/1.0
Server: Moritz B./15.11.90
Location: Friedberg (BY)
Content-Language: de-by
X-Please-Bookmark: http://www.diplomtrottel.de
Connection: keep-alive
↑  ↓

#9 26.02.2007, 21:59
MaMo Abwesend
Administrator
Dabei seit: 06.04.2004
Beiträge: 2.675


Betreff: Re: Viscacha 0.9 / Derzeit kein Support möglich [Update]
Hi,

tut mir leid, dass ich in letzter Zeit hier so inaktiv war, aber ich hatte schulisch viel zu tun und die letzten beiden Wochenenden habe ich sozusagen nicht gehabt. Das nächste wird auch sehr streßig, bin nicht mal in Bielefeld.

Nun, mit Viscacha 0.9 kann derzeit noch niemand rechnen. Das meiste sind noch Planung und Entwurf, damit wir hinterher ein durchdachtes Konzept haben. Die erste Alpha (des Core, nicht des Boards) würde ich auf Sommer terminieren.

Viscacha 0.8 RC2 entwickelt sich nicht so recht, da kaum etwas zu ändern ist (keine Bugs bekannt). Falls sich das nicht ändert, werde ich evtl. die bereinigt RC2 demnächst raus bringen (in 2 Wochen) und bei Bedarf noch eine RC3 einschieben - aber schauen wir mal. Für RC2 muss ich derzeit nur noch den Installer anpassen. Fehlerbereinigungen kann man sich schon per SVN besorgen, falls irgendwas dringendes anliegt.

Mit freundlichen Grüßen MaMo
Matthias M.
=> Support nur per Forum - dann haben alle etwas davon!
↑  ↓

#10 28.02.2007, 12:51
Anna Abwesend
Mitglied
Dabei seit: 20.08.2006
Beiträge: 10


Betreff: Re: Viscacha 0.9 / Derzeit kein Support möglich [Update]
Schön, das sind ja immerhin gute Nachrichten, mich hatte es nur halt gewundert, dass der Bugtracker nun seit vielen Wochen im Fortschritt unverändert bleibt, aber auf dieser Seite sieht man ja bereits, dass der RC2 bereits lauffähig ist.
Dann lehne ich mich erstmal zurück und warte, bis RC2 endlich zum Testen veröffentlicht wird Smiling

PS: Wie sieht es denn bis dato mit den Konvertern aus? Werden diese im Zuge von RC2 mit in das Paket integriert, oder sollen diese dann speparat erhältlich sein, und sind diese schon bereits fertig gestellt?
↑  ↓

Seiten (3): 1, 2, 3


Alle Zeitangaben in GMT +02:00. Aktuelle Uhrzeit: 07:25.