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
ae534f69
Commit
ae534f69
authored
Sep 03, 2006
by
pookey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor changes to Doctrine::compile(), adding extra error handling and improving docs
parent
1a265b07
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
14 deletions
+28
-14
Doctrine.php
Doctrine.php
+20
-14
Getting started - Compiling.php
manual/docs/Getting started - Compiling.php
+8
-0
No files found.
Doctrine.php
View file @
ae534f69
...
...
@@ -386,7 +386,6 @@ final class Doctrine {
}
/**
* method for making a single file of most used doctrine runtime components
*
* including the compiled file instead of multiple files (in worst
* cases dozens of files) can improve performance by an order of magnitude
*
...
...
@@ -449,28 +448,35 @@ final class Doctrine {
$end
=
$refl
->
getEndLine
();
$ret
=
array_merge
(
$ret
,
array_slice
(
$lines
,
$start
,
(
$end
-
$start
)));
array_slice
(
$lines
,
$start
,
(
$end
-
$start
)));
}
$file
=
self
::
$path
.
DIRECTORY_SEPARATOR
.
'Doctrine.compiled.php'
;
$fp
=
fopen
(
$file
,
'w+'
);
fwrite
(
$fp
,
"<?php
"
.
implode
(
''
,
$ret
)
.
"
class InvalidKeyException extends Exception { }
class DQLException extends Exception { }
?>"
);
if
(
!
is_writable
(
$file
))
throw
new
Doctrine_Exception
(
"Couldn't write compiled data.
$file
is not writable"
);
// first write the 'compiled' data to a text file, so
// that we can use php_strip_whitespace (which only works on files)
$fp
=
fopen
(
$file
,
'w'
);
if
(
$fp
===
false
)
throw
new
Doctrine_Exception
(
"Couldn't write compiled data. Failed to open
$file
"
);
fwrite
(
$fp
,
"<?php "
.
implode
(
''
,
$ret
)
.
"
\n
class InvalidKeyException extends Exception { }"
.
"
\n
class DQLException extends Exception { }"
);
fclose
(
$fp
);
$stripped
=
php_strip_whitespace
(
$file
);
$fp
=
fopen
(
$file
,
'w+'
);
$stripped
=
php_strip_whitespace
(
$file
);
$fp
=
fopen
(
$file
,
'w'
);
if
(
$fp
===
false
)
throw
new
Doctrine_Exception
(
"Couldn't write compiled data. Failed to open
$file
"
);
fwrite
(
$fp
,
$stripped
);
fclose
(
$fp
);
}
/**
* simple autoload function
* returns true if the class was loaded, otherwise false
...
...
manual/docs/Getting started - Compiling.php
View file @
ae534f69
<p>
Compiling is a method for making a single file of most used doctrine runtime components
including the compiled file instead of multiple files (in worst cases dozens of files)
can improve performance by an order of magnitude.
</p>
<p>
In cases where this might fail, a Doctrine_Exception is throw detailing the error.
</p>
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