File tree 1 file changed +13
-2
lines changed
1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,17 @@ class Storage extends Component
21
21
{
22
22
protected $ _path ;
23
23
protected $ _locker ;
24
+
25
+ protected static $ _instance ;
26
+
27
+ public static function getInstance ()
28
+ {
29
+ if (static ::$ _instance === null ) {
30
+ static ::$ _instance = new static ();
31
+ }
32
+
33
+ return static ::$ _instance ;
34
+ }
24
35
25
36
public function init ()
26
37
{
@@ -105,7 +116,7 @@ public function readPackage(AssetPackage $package)
105
116
$ name = $ package ->getNormalName ();
106
117
$ path = $ this ->buildHashedPath ($ name );
107
118
if (!file_exists ($ path )) {
108
- return [] ;
119
+ return null ;
109
120
}
110
121
$ json = file_get_contents ($ path );
111
122
$ updateTime = filemtime ($ path );
@@ -135,7 +146,7 @@ protected function writeProviderLatest($name, $hash)
135
146
if (file_exists ($ latest_path )) {
136
147
$ data = Json::decode (file_get_contents ($ latest_path ) ?: '[] ' );
137
148
}
138
- if (!is_array ($ data )) {
149
+ if (!isset ( $ data )||! is_array ($ data )) {
139
150
$ data = [];
140
151
}
141
152
if (!isset ($ data ['providers ' ])) {
You can’t perform that action at this time.
0 commit comments