Updating classloading for normal and Rest, requests
This commit is contained in:
@@ -5,6 +5,8 @@ class ClassLoader
|
||||
{
|
||||
private static $includePath = array();
|
||||
private static $includePathNs = array();
|
||||
private static $includeModelPath = array();
|
||||
private static $includeClassPath = array();
|
||||
protected static $instance;
|
||||
|
||||
/**
|
||||
@@ -60,6 +62,22 @@ class ClassLoader
|
||||
}
|
||||
}
|
||||
|
||||
public function addModelClassPath($classPath)
|
||||
{
|
||||
self::$includeModelPath[] = $classPath;
|
||||
}
|
||||
|
||||
public function addClass($class, $path)
|
||||
{
|
||||
self::$includeClassPath[$class] = $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the given class or interface.
|
||||
*
|
||||
* @param string $className The name of the class to load.
|
||||
* @return void
|
||||
*/
|
||||
function loadClass($className)
|
||||
{
|
||||
$classPath = str_replace(NS, DS, $className);
|
||||
@@ -78,9 +96,25 @@ class ClassLoader
|
||||
}
|
||||
}
|
||||
|
||||
if (isset(self::$includeClassPath[$className]) && file_exists(self::$includeClassPath[$className])) {
|
||||
require self::$includeClassPath[$className];
|
||||
}
|
||||
|
||||
foreach (self::$includeModelPath as $path) {
|
||||
if (file_exists($path.$className.".php")) {
|
||||
require $path.$className.".php";
|
||||
return true;
|
||||
} elseif (file_exists($path."om".DS.$className.".php")) {
|
||||
require $path."om".DS.$className.".php";
|
||||
return true;
|
||||
} elseif (file_exists($path."map".DS.$className.".php")) {
|
||||
require $path."map".DS.$className.".php";
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (self::$includePath as $path) {
|
||||
$filename = $path . $classPath . ".php";
|
||||
//var_dump($filename);
|
||||
|
||||
if (file_exists($filename)) {
|
||||
require $filename;
|
||||
@@ -91,27 +125,6 @@ class ClassLoader
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the given class or interface.
|
||||
*
|
||||
* @param string $className The name of the class to load.
|
||||
* @return void
|
||||
*/
|
||||
public function loadClass2($className)
|
||||
{
|
||||
if (null === $this->_namespace || $this->_namespace.$this->_namespaceSeparator === substr($className, 0, strlen($this->_namespace.$this->_namespaceSeparator))) {
|
||||
$fileName = '';
|
||||
$namespace = '';
|
||||
|
||||
if (false !== ($lastNsPos = strripos($className, $this->_namespaceSeparator))) {
|
||||
$namespace = substr($className, 0, $lastNsPos);
|
||||
$className = substr($className, $lastNsPos + 1);
|
||||
$fileName = str_replace($this->_namespaceSeparator, DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
|
||||
}
|
||||
|
||||
$fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . $this->_fileExtension;
|
||||
|
||||
require ($this->_includePath !== null ? $this->_includePath . DIRECTORY_SEPARATOR : '') . $fileName;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -257,6 +257,7 @@ class WebApplication
|
||||
define('PATH_RBAC', PATH_RBAC_HOME . 'engine' . PATH_SEP . 'classes' . PATH_SEP); //to enable rbac version 2
|
||||
define('PATH_RBAC_CORE', PATH_RBAC_HOME . 'engine' . PATH_SEP);
|
||||
define('PATH_CORE', PATH_HOME . 'engine' . PATH_SEP);
|
||||
define('PATH_CLASSES', PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP);
|
||||
define('PATH_SKINS', PATH_CORE . 'skins' . PATH_SEP);
|
||||
define('PATH_SKIN_ENGINE', PATH_CORE . 'skinEngine' . PATH_SEP);
|
||||
define('PATH_METHODS', PATH_CORE . 'methods' . PATH_SEP);
|
||||
@@ -283,18 +284,17 @@ class WebApplication
|
||||
|
||||
spl_autoload_register(array("Bootstrap", "autoloadClass"));
|
||||
|
||||
\Bootstrap::registerClass("G", PATH_GULLIVER . "class.g.php");
|
||||
\Bootstrap::registerClass("System", PATH_HOME . "engine/classes/class.system.php");
|
||||
// \Bootstrap::registerClass("G", PATH_GULLIVER . "class.g.php");
|
||||
// \Bootstrap::registerClass("System", PATH_HOME . "engine/classes/class.system.php");
|
||||
|
||||
// define autoloading for others
|
||||
\Bootstrap::registerClass("wsBase", PATH_HOME . "engine/classes/class.wsBase.php");
|
||||
\Bootstrap::registerClass('Xml_Node', PATH_GULLIVER . "class.xmlDocument.php");
|
||||
\Bootstrap::registerClass('XmlForm_Field_TextPM', PATH_HOME . "engine/classes/class.XmlForm_Field_TextPM.php");
|
||||
\Bootstrap::registerClass('XmlForm_Field_SimpleText', PATH_GULLIVER . "class.xmlformExtension.php");
|
||||
\Bootstrap::registerClass('XmlForm_Field', PATH_GULLIVER . "class.xmlform.php");
|
||||
// \Bootstrap::registerClass("wsBase", PATH_HOME . "engine/classes/class.wsBase.php");
|
||||
// \Bootstrap::registerClass('Xml_Node', PATH_GULLIVER . "class.xmlDocument.php");
|
||||
// \Bootstrap::registerClass('XmlForm_Field_TextPM', PATH_HOME . "engine/classes/class.XmlForm_Field_TextPM.php");
|
||||
// \Bootstrap::registerClass('XmlForm_Field_SimpleText', PATH_GULLIVER . "class.xmlformExtension.php");
|
||||
// \Bootstrap::registerClass('XmlForm_Field', PATH_GULLIVER . "class.xmlform.php");
|
||||
|
||||
|
||||
//\Bootstrap::registerDir('model', PATH_CORE . 'classes' . PATH_SEP . 'model');
|
||||
//\Bootstrap::registerDir('rbac/model', PATH_RBAC_HOME . 'engine' . PATH_SEP . 'classes' . PATH_SEP . 'model');
|
||||
|
||||
//\Bootstrap::LoadThirdParty("smarty/libs", "Smarty.class");
|
||||
|
||||
@@ -319,7 +319,6 @@ class WebApplication
|
||||
define('MEMCACHED_SERVER', $config['memcached_server']);
|
||||
define('TIME_ZONE', $config['time_zone']);
|
||||
|
||||
|
||||
// set include path
|
||||
set_include_path(
|
||||
PATH_CORE . PATH_SEPARATOR .
|
||||
@@ -335,7 +334,7 @@ class WebApplication
|
||||
*/
|
||||
|
||||
// include the server installed configuration
|
||||
require_once FILE_PATHS_INSTALLED;
|
||||
require_once PATH_CORE . 'config' . PATH_SEP . 'paths_installed.php';
|
||||
|
||||
define('SYS_SYS', $workspace);
|
||||
|
||||
@@ -373,7 +372,7 @@ class WebApplication
|
||||
}
|
||||
|
||||
// create memcached singleton
|
||||
\Bootstrap::LoadClass('memcached');
|
||||
//\Bootstrap::LoadClass('memcached');
|
||||
//$memcache = PMmemcached::getSingleton( SYS_SYS );
|
||||
|
||||
\Propel::init(PATH_CONFIG . "databases.php");
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -35,13 +35,15 @@ try {
|
||||
$loader = Maveriks\Util\ClassLoader::getInstance();
|
||||
$loader->add($rootDir . 'framework/src/', "Maveriks");
|
||||
$loader->add($rootDir . 'workflow/engine/src/', "ProcessMaker");
|
||||
//$loader->add($rootDir . "workflow/engine/classes/model/");
|
||||
$loader->add($rootDir . 'workflow/engine/src/');
|
||||
$loader->add($rootDir . 'workflow/engine/classes/model/');
|
||||
|
||||
// and vendors to autoloader
|
||||
$loader->add($rootDir . 'vendor/luracast/restler/vendor', "Luracast");
|
||||
$loader->add($rootDir . 'vendor/bshaffer/oauth2-server-php/src/', "OAuth2");
|
||||
|
||||
$loader->addModelClassPath($rootDir . "workflow/engine/classes/model/");
|
||||
|
||||
$app = new Maveriks\WebApplication();
|
||||
|
||||
$app->setRootDir($rootDir);
|
||||
|
||||
@@ -185,6 +185,7 @@ define( 'PATH_RBAC_CORE', PATH_RBAC_HOME . 'engine' . PATH_SEP );
|
||||
|
||||
// Defining PMCore Path constants
|
||||
define( 'PATH_CORE', PATH_HOME . 'engine' . PATH_SEP );
|
||||
define( 'PATH_CLASSES', PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP );
|
||||
define( 'PATH_SKINS', PATH_CORE . 'skins' . PATH_SEP );
|
||||
define( 'PATH_SKIN_ENGINE', PATH_CORE . 'skinEngine' . PATH_SEP );
|
||||
define( 'PATH_METHODS', PATH_CORE . 'methods' . PATH_SEP );
|
||||
@@ -328,10 +329,7 @@ define( 'PATH_LANGUAGECONT', PATH_HOME . 'engine/content/languages/' );
|
||||
Bootstrap::LoadThirdParty("smarty/libs", "Smarty.class");
|
||||
|
||||
//Loading the autoloader libraries feature
|
||||
spl_autoload_register(array("Bootstrap", "autoloadClass"));
|
||||
|
||||
Bootstrap::registerClass("G", PATH_GULLIVER . "class.g.php");
|
||||
Bootstrap::registerClass("System", PATH_HOME . "engine/classes/class.system.php");
|
||||
Bootstrap::registerSystemClasses();
|
||||
|
||||
$skinPathErrors = G::skinGetPathToSrcByVirtualUri("errors", $config);
|
||||
$skinPathUpdate = G::skinGetPathToSrcByVirtualUri("update", $config);
|
||||
@@ -485,40 +483,6 @@ if (defined( 'PATH_DATA' ) && file_exists( PATH_DATA )) {
|
||||
$oServerConf = & serverConf::getSingleton();
|
||||
}
|
||||
|
||||
// Call more Classes
|
||||
Bootstrap::registerClass('headPublisher', PATH_GULLIVER . "class.headPublisher.php");
|
||||
Bootstrap::registerClass('publisher', PATH_GULLIVER . "class.publisher.php");
|
||||
Bootstrap::registerClass('xmlform', PATH_GULLIVER . "class.xmlform.php");
|
||||
Bootstrap::registerClass('XmlForm_Field', PATH_GULLIVER . "class.xmlform.php");
|
||||
Bootstrap::registerClass('xmlformExtension', PATH_GULLIVER . "class.xmlformExtension.php");
|
||||
Bootstrap::registerClass('form', PATH_GULLIVER . "class.form.php");
|
||||
Bootstrap::registerClass('menu', PATH_GULLIVER . "class.menu.php");
|
||||
Bootstrap::registerClass('Xml_Document', PATH_GULLIVER . "class.xmlDocument.php");
|
||||
Bootstrap::registerClass('DBSession', PATH_GULLIVER . "class.dbsession.php");
|
||||
Bootstrap::registerClass('DBConnection', PATH_GULLIVER . "class.dbconnection.php");
|
||||
Bootstrap::registerClass('DBRecordset', PATH_GULLIVER . "class.dbrecordset.php");
|
||||
Bootstrap::registerClass('DBTable', PATH_GULLIVER . "class.dbtable.php");
|
||||
Bootstrap::registerClass('xmlMenu', PATH_GULLIVER . "class.xmlMenu.php");
|
||||
Bootstrap::registerClass('XmlForm_Field_FastSearch', PATH_GULLIVER . "class.xmlformExtension.php");
|
||||
Bootstrap::registerClass('XmlForm_Field_XmlMenu', PATH_GULLIVER . "class.xmlMenu.php");
|
||||
Bootstrap::registerClass('XmlForm_Field_HTML', PATH_GULLIVER . "class.dvEditor.php");
|
||||
Bootstrap::registerClass('XmlForm_Field_WYSIWYG_EDITOR', PATH_GULLIVER . "class.wysiwygEditor.php");
|
||||
Bootstrap::registerClass('Controller', PATH_GULLIVER . "class.controller.php");
|
||||
Bootstrap::registerClass('HttpProxyController', PATH_GULLIVER . "class.httpProxyController.php");
|
||||
Bootstrap::registerClass('templatePower', PATH_GULLIVER . "class.templatePower.php");
|
||||
Bootstrap::registerClass('XmlForm_Field_SimpleText', PATH_GULLIVER . "class.xmlformExtension.php");
|
||||
Bootstrap::registerClass('PmSessionHandler', PATH_GULLIVER_HOME . 'core/Session/PmSessionHandler.php');
|
||||
Bootstrap::registerClass('Groups', PATH_HOME . "engine/classes/class.groups.php");
|
||||
Bootstrap::registerClass('Tasks', PATH_HOME . "engine/classes/class.tasks.php");
|
||||
Bootstrap::registerClass('Calendar', PATH_HOME . "engine/classes/class.calendar.php");
|
||||
Bootstrap::registerClass('processMap', PATH_HOME . "engine/classes/class.processMap.php");
|
||||
|
||||
Bootstrap::registerSystemClasses();
|
||||
|
||||
Bootstrap::registerDir('src', PATH_HOME . 'engine/src/');
|
||||
Bootstrap::registerDir('model', PATH_CORE . 'classes' . PATH_SEP . 'model');
|
||||
Bootstrap::registerDir('rbac/model', PATH_RBAC_HOME . 'engine' . PATH_SEP . 'classes' . PATH_SEP . 'model');
|
||||
|
||||
require_once PATH_THIRDPARTY . '/pear/PEAR.php';
|
||||
|
||||
//Bootstrap::LoadSystem( 'pmException' );
|
||||
|
||||
Reference in New Issue
Block a user