Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
e4db5eb3
Commit
e4db5eb3
authored
Jun 12, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
made compiler dynamic
parent
422890ce
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
230 deletions
+24
-230
Compiler.php
lib/Doctrine/Compiler.php
+24
-230
No files found.
lib/Doctrine/Compiler.php
View file @
e4db5eb3
...
...
@@ -32,213 +32,6 @@
*/
class
Doctrine_Compiler
{
/**
* @var array $classes an array containing all runtime classes of Doctrine framework
*/
private
static
$classes
=
array
(
'Doctrine'
,
'Access'
,
'Adapter_Interface'
,
'Adapter_Statement_Interface'
,
'Adapter_Statement'
,
'Adapter'
,
'Cache_Query_Sqlite'
,
'Collection'
,
'Collection_Iterator'
,
'Collection_Batch'
,
'Collection_Exception'
,
'Collection_Immediate'
,
'Collection_Iterator_Expandable'
,
'Collection_Iterator_Normal'
,
'Collection_Iterator_Offset'
,
'Collection_Lazy'
,
'Collection_Offset'
,
'Compiler_Exception'
,
'Compiler'
,
'Configurable'
,
'Connection'
,
'Connection_Common'
,
'Connection_Db2'
,
'Connection_Exception'
,
'Connection_Firebird_Exception'
,
'Connection_Firebird'
,
'Connection_Informix_Exception'
,
'Connection_Informix'
,
'Connection_Mock'
,
'Connection_Module'
,
'Connection_Mssql_Exception'
,
'Connection_Mssql'
,
'Connection_Mysql_Exception'
,
'Connection_Mysql'
,
'Connection_Oracle_Exception'
,
'Connection_Oracle'
,
'Connection_Pgsql_Exception'
,
'Connection_Pgsql'
,
'Connection_Sqlite_Exception'
,
'Connection_Sqlite'
,
'Connection_UnitOfWork'
,
'DataDict_Exception'
,
'DataDict_Firebird'
,
'DataDict_Informix'
,
'DataDict_Mssql'
,
'DataDict_Mysql'
,
'DataDict_Oracle'
,
'DataDict_Pgsql'
,
'DataDict_Sqlite'
,
'DataDict'
,
'Db'
,
'Db_Event'
,
'Db_EventListener_Chain'
,
'Db_EventListener_Interface'
,
'Db_EventListener'
,
'Db_Exception'
,
'Db_Mock'
,
'Db_Profiler_Exception'
,
'Db_Profiler_Query'
,
'Db_Profiler'
,
'Db_Statement'
,
'EventListener_Interface'
,
'EventListener'
,
'EventListener_AccessorInvoker'
,
'EventListener_Chain'
,
'EventListener_Debugger'
,
'EventListener_Empty'
,
'Exception'
,
'Export'
,
'Export_Exception'
,
'Export_Firebird'
,
'Export_Mssql'
,
'Export_Mysql'
,
'Export_Oracle'
,
'Export_Pgsql'
,
'Export_Reporter'
,
'Export_Sqlite'
,
'Expression'
,
'Expression_Exception'
,
'Expression_Firebird'
,
'Expression_Informix'
,
'Expression_Mssql'
,
'Expression_Mysql'
,
'Expression_Oracle'
,
'Expression_Pgsql'
,
'Expression_Sqlite'
,
'Hook'
,
'Hook_Parser'
,
'Hook_Parser_Complex'
,
'Hook_Equal'
,
'Hook_Integer'
,
'Hook_WordLike'
,
'Hydrate_Alias'
,
'Hydrate'
,
'Identifier'
,
'Import_Builder'
,
'Import_Builder_BaseClass'
,
'Import_Builder_Exception'
,
'Import'
,
'Import_Exception'
,
'Import_Firebird'
,
'Import_Informix'
,
'Import_Mssql'
,
'Import_Mysql'
,
'Import_Oracle'
,
'Import_Pgsql'
,
'Import_Reader_Db'
,
'Import_Reader'
,
'Import_Sqlite'
,
'Lib'
,
'Locking_Exception'
,
'Locking_Manager_Pessimistic'
,
'Manager_Exception'
,
'Manager'
,
'Null'
,
'Overloadable'
,
'Query'
,
'Query_Part'
,
'Query_Condition'
,
'Query_Exception'
,
'Query_From'
,
'Query_Groupby'
,
'Query_Having'
,
'Query_JoinCondition'
,
'Query_Orderby'
,
'Query_Set'
,
'Query_Where'
,
'RawSql_Exception'
,
'RawSql'
,
'Record'
,
'Record_Exception'
,
'Record_Filter'
,
'Record_Iterator'
,
'Record_State_Exception'
,
'Relation'
,
'Relation_Association_Self'
,
'Relation_Association'
,
'Relation_ForeignKey'
,
'Relation_LocalKey'
,
'Reporter'
,
'Schema_Object'
,
'Schema_Column'
,
'Schema_Database'
,
'Schema_Exception'
,
'Schema_Relation'
,
'Schema_Table'
,
'Schema'
,
'Sequence'
,
'Sequence_Db2'
,
'Sequence_Exception'
,
'Sequence_Firebird'
,
'Sequence_Informix'
,
'Sequence_Mssql'
,
'Sequence_Mysql'
,
'Sequence_Oracle'
,
'Sequence_Pgsql'
,
'Sequence_Sqlite'
,
'Table_Exception'
,
'Table'
,
'Table_Repository_Exception'
,
'Table_Repository'
,
'Transaction'
,
'Transaction_Exception'
,
'Transaction_Firebird'
,
'Transaction_Informix'
,
'Transaction_Mssql'
,
'Transaction_Mysql'
,
'Transaction_Oracle'
,
'Transaction_Pgsql'
,
'Transaction_Sqlite'
,
'Validator'
,
'Validator_Country'
,
'Validator_Creditcard'
,
'Validator_Date'
,
'Validator_Email'
,
'Validator_Enum'
,
'Validator_ErrorStack'
,
'Validator_Exception'
,
'Validator_Htmlcolor'
,
'Validator_Ip'
,
'Validator_Nospace'
,
'Validator_Notblank'
,
'Validator_Notnull'
,
'Validator_Range'
,
'Validator_Regexp'
,
'Validator_Unique'
,
'Validator_Unsigned'
,
'Validator_Usstate'
,
'ValueHolder'
,
'View_Exception'
,
'View'
,
);
/**
* getRuntimeClasses
* returns an array containing all runtime classes of Doctrine framework
*
* @return array
*/
public
static
function
getRuntimeClasses
()
{
return
self
::
$classes
;
}
/**
* method for making a single file of most used doctrine runtime components
* including the compiled file instead of multiple files (in worst
...
...
@@ -250,38 +43,42 @@ class Doctrine_Compiler
public
static
function
compile
(
$target
=
null
)
{
$path
=
Doctrine
::
getPath
();
$it
=
new
RecursiveIteratorIterator
(
new
RecursiveDirectoryIterator
(
$path
),
RecursiveIteratorIterator
::
LEAVES_ONLY
);
foreach
(
$it
as
$file
)
{
$e
=
explode
(
'.'
,
$file
->
getFileName
());
// we don't want to require versioning files
if
(
end
(
$e
)
===
'php'
&&
count
(
$e
)
===
2
)
{
require_once
$file
->
getPathName
();
}
}
$classes
=
self
::
$classes
;
$classes
=
get_declared_classes
()
;
$ret
=
array
();
foreach
(
$classes
as
$class
)
{
if
(
$class
!==
'Doctrine'
)
$class
=
'Doctrine_'
.
$class
;
$file
=
$path
.
DIRECTORY_SEPARATOR
.
str_replace
(
"_"
,
DIRECTORY_SEPARATOR
,
$class
)
.
".php"
;
echo
"Adding
$file
"
.
PHP_EOL
;
$e
=
explode
(
'_'
,
$class
);
if
(
!
file_exists
(
$file
)
)
{
throw
new
Doctrine_Compiler_Exception
(
"Couldn't compile
$file
. File
$file
does not exists."
)
;
if
(
$e
[
0
]
!==
'Doctrine'
)
{
continue
;
}
Doctrine
::
autoload
(
$class
);
$refl
=
new
ReflectionClass
(
$class
);
$lines
=
file
(
$file
);
$refl
=
new
ReflectionClass
(
$class
);
$file
=
$refl
->
getFileName
();
print
'Adding '
.
$file
.
PHP_EOL
;
$start
=
$refl
->
getStartLine
()
-
1
;
$end
=
$refl
->
getEndLine
();
$lines
=
file
(
$file
);
$ret
=
array_merge
(
$ret
,
array_slice
(
$lines
,
$start
,
(
$end
-
$start
)));
$start
=
$refl
->
getStartLine
()
-
1
;
$end
=
$refl
->
getEndLine
();
$ret
=
array_merge
(
$ret
,
array_slice
(
$lines
,
$start
,
(
$end
-
$start
)));
}
if
(
$target
==
null
)
{
$target
=
$path
.
DIRECTORY_SEPARATOR
.
'Doctrine.compiled.php'
;
$target
=
$path
.
DIRECTORY_SEPARATOR
.
'Doctrine.compiled.php'
;
}
// first write the 'compiled' data to a text file, so
...
...
@@ -291,10 +88,7 @@ class Doctrine_Compiler
if
(
$fp
===
false
)
{
throw
new
Doctrine_Compiler_Exception
(
"Couldn't write compiled data. Failed to open
$target
"
);
}
fwrite
(
$fp
,
"<?php"
.
" class InvalidKeyException extends Exception { }"
.
implode
(
''
,
$ret
)
);
fwrite
(
$fp
,
"<?php "
.
implode
(
''
,
$ret
));
fclose
(
$fp
);
$stripped
=
php_strip_whitespace
(
$target
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment