Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Nextcloud
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Nextcloud
Commits
4a2a4119
Commit
4a2a4119
authored
8 years ago
by
Roeland Jago Douma
Committed by
GitHub
8 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #2876 from nextcloud/composer_update
Bump autoloader
parents
52b734b3
03cb491a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/composer/composer/ClassLoader.php
+31
-5
31 additions, 5 deletions
lib/composer/composer/ClassLoader.php
with
31 additions
and
5 deletions
lib/composer/composer/ClassLoader.php
+
31
−
5
View file @
4a2a4119
...
@@ -55,6 +55,7 @@ class ClassLoader
...
@@ -55,6 +55,7 @@ class ClassLoader
private
$classMap
=
array
();
private
$classMap
=
array
();
private
$classMapAuthoritative
=
false
;
private
$classMapAuthoritative
=
false
;
private
$missingClasses
=
array
();
private
$missingClasses
=
array
();
private
$apcuPrefix
;
public
function
getPrefixes
()
public
function
getPrefixes
()
{
{
...
@@ -271,6 +272,26 @@ class ClassLoader
...
@@ -271,6 +272,26 @@ class ClassLoader
return
$this
->
classMapAuthoritative
;
return
$this
->
classMapAuthoritative
;
}
}
/**
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
*
* @param string|null $apcuPrefix
*/
public
function
setApcuPrefix
(
$apcuPrefix
)
{
$this
->
apcuPrefix
=
function_exists
(
'apcu_fetch'
)
&&
ini_get
(
'apc.enabled'
)
?
$apcuPrefix
:
null
;
}
/**
* The APCu prefix in use, or null if APCu caching is not enabled.
*
* @return string|null
*/
public
function
getApcuPrefix
()
{
return
$this
->
apcuPrefix
;
}
/**
/**
* Registers this instance as an autoloader.
* Registers this instance as an autoloader.
*
*
...
@@ -313,11 +334,6 @@ class ClassLoader
...
@@ -313,11 +334,6 @@ class ClassLoader
*/
*/
public
function
findFile
(
$class
)
public
function
findFile
(
$class
)
{
{
// work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731
if
(
'\\'
==
$class
[
0
])
{
$class
=
substr
(
$class
,
1
);
}
// class map lookup
// class map lookup
if
(
isset
(
$this
->
classMap
[
$class
]))
{
if
(
isset
(
$this
->
classMap
[
$class
]))
{
return
$this
->
classMap
[
$class
];
return
$this
->
classMap
[
$class
];
...
@@ -325,6 +341,12 @@ class ClassLoader
...
@@ -325,6 +341,12 @@ class ClassLoader
if
(
$this
->
classMapAuthoritative
||
isset
(
$this
->
missingClasses
[
$class
]))
{
if
(
$this
->
classMapAuthoritative
||
isset
(
$this
->
missingClasses
[
$class
]))
{
return
false
;
return
false
;
}
}
if
(
null
!==
$this
->
apcuPrefix
)
{
$file
=
apcu_fetch
(
$this
->
apcuPrefix
.
$class
,
$hit
);
if
(
$hit
)
{
return
$file
;
}
}
$file
=
$this
->
findFileWithExtension
(
$class
,
'.php'
);
$file
=
$this
->
findFileWithExtension
(
$class
,
'.php'
);
...
@@ -333,6 +355,10 @@ class ClassLoader
...
@@ -333,6 +355,10 @@ class ClassLoader
$file
=
$this
->
findFileWithExtension
(
$class
,
'.hh'
);
$file
=
$this
->
findFileWithExtension
(
$class
,
'.hh'
);
}
}
if
(
null
!==
$this
->
apcuPrefix
)
{
apcu_add
(
$this
->
apcuPrefix
.
$class
,
$file
);
}
if
(
false
===
$file
)
{
if
(
false
===
$file
)
{
// Remember that this class does not exist.
// Remember that this class does not exist.
$this
->
missingClasses
[
$class
]
=
true
;
$this
->
missingClasses
[
$class
]
=
true
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment