@@ -33,15 +33,15 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach
33
33
* @access private
34
34
* @var string
35
35
*/
36
- private $ _cachePrefix = null ;
36
+ private $ cachePrefix = null ;
37
37
38
38
/**
39
39
* Cache timeout
40
40
*
41
41
* @access private
42
42
* @var integer
43
43
*/
44
- private $ _cacheTime = 600 ;
44
+ private $ cacheTime = 600 ;
45
45
46
46
/**
47
47
* Store cell data in cache for the current cell object if it's "dirty",
@@ -51,22 +51,22 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach
51
51
* @return void
52
52
* @throws PHPExcel_Exception
53
53
*/
54
- protected function _storeData ()
54
+ protected function storeData ()
55
55
{
56
- if ($ this ->_currentCellIsDirty && !empty ($ this ->_currentObjectID )) {
57
- $ this ->_currentObject ->detach ();
56
+ if ($ this ->currentCellIsDirty && !empty ($ this ->currentObjectID )) {
57
+ $ this ->currentObject ->detach ();
58
58
59
59
if (!apc_store (
60
- $ this ->_cachePrefix . $ this ->_currentObjectID . '.cache ' ,
61
- serialize ($ this ->_currentObject ),
62
- $ this ->_cacheTime
60
+ $ this ->cachePrefix . $ this ->currentObjectID . '.cache ' ,
61
+ serialize ($ this ->currentObject ),
62
+ $ this ->cacheTime
63
63
)) {
64
64
$ this ->__destruct ();
65
- throw new PHPExcel_Exception ('Failed to store cell ' . $ this ->_currentObjectID . ' in APC ' );
65
+ throw new PHPExcel_Exception ('Failed to store cell ' . $ this ->currentObjectID . ' in APC ' );
66
66
}
67
- $ this ->_currentCellIsDirty = false ;
67
+ $ this ->currentCellIsDirty = false ;
68
68
}
69
- $ this ->_currentObjectID = $ this ->_currentObject = null ;
69
+ $ this ->currentObjectID = $ this ->currentObject = null ;
70
70
}
71
71
72
72
/**
@@ -80,14 +80,14 @@ protected function _storeData()
80
80
*/
81
81
public function addCacheData ($ pCoord , PHPExcel_Cell $ cell )
82
82
{
83
- if (($ pCoord !== $ this ->_currentObjectID ) && ($ this ->_currentObjectID !== null )) {
84
- $ this ->_storeData ();
83
+ if (($ pCoord !== $ this ->currentObjectID ) && ($ this ->currentObjectID !== null )) {
84
+ $ this ->storeData ();
85
85
}
86
- $ this ->_cellCache [$ pCoord ] = true ;
86
+ $ this ->cellCache [$ pCoord ] = true ;
87
87
88
- $ this ->_currentObjectID = $ pCoord ;
89
- $ this ->_currentObject = $ cell ;
90
- $ this ->_currentCellIsDirty = true ;
88
+ $ this ->currentObjectID = $ pCoord ;
89
+ $ this ->currentObject = $ cell ;
90
+ $ this ->currentCellIsDirty = true ;
91
91
92
92
return $ cell ;
93
93
}
@@ -104,11 +104,11 @@ public function isDataSet($pCoord)
104
104
{
105
105
// Check if the requested entry is the current object, or exists in the cache
106
106
if (parent ::isDataSet ($ pCoord )) {
107
- if ($ this ->_currentObjectID == $ pCoord ) {
107
+ if ($ this ->currentObjectID == $ pCoord ) {
108
108
return true ;
109
109
}
110
110
// Check if the requested entry still exists in apc
111
- $ success = apc_fetch ($ this ->_cachePrefix .$ pCoord .'.cache ' );
111
+ $ success = apc_fetch ($ this ->cachePrefix .$ pCoord .'.cache ' );
112
112
if ($ success === false ) {
113
113
// Entry no longer exists in APC, so clear it from the cache array
114
114
parent ::deleteCacheData ($ pCoord );
@@ -129,14 +129,14 @@ public function isDataSet($pCoord)
129
129
*/
130
130
public function getCacheData ($ pCoord )
131
131
{
132
- if ($ pCoord === $ this ->_currentObjectID ) {
133
- return $ this ->_currentObject ;
132
+ if ($ pCoord === $ this ->currentObjectID ) {
133
+ return $ this ->currentObject ;
134
134
}
135
- $ this ->_storeData ();
135
+ $ this ->storeData ();
136
136
137
137
// Check if the entry that has been requested actually exists
138
138
if (parent ::isDataSet ($ pCoord )) {
139
- $ obj = apc_fetch ($ this ->_cachePrefix . $ pCoord . '.cache ' );
139
+ $ obj = apc_fetch ($ this ->cachePrefix . $ pCoord . '.cache ' );
140
140
if ($ obj === false ) {
141
141
// Entry no longer exists in APC, so clear it from the cache array
142
142
parent ::deleteCacheData ($ pCoord );
@@ -148,13 +148,13 @@ public function getCacheData($pCoord)
148
148
}
149
149
150
150
// Set current entry to the requested entry
151
- $ this ->_currentObjectID = $ pCoord ;
152
- $ this ->_currentObject = unserialize ($ obj );
151
+ $ this ->currentObjectID = $ pCoord ;
152
+ $ this ->currentObject = unserialize ($ obj );
153
153
// Re-attach this as the cell's parent
154
- $ this ->_currentObject ->attach ($ this );
154
+ $ this ->currentObject ->attach ($ this );
155
155
156
156
// Return requested entry
157
- return $ this ->_currentObject ;
157
+ return $ this ->currentObject ;
158
158
}
159
159
160
160
/**
@@ -164,8 +164,8 @@ public function getCacheData($pCoord)
164
164
*/
165
165
public function getCellList ()
166
166
{
167
- if ($ this ->_currentObjectID !== null ) {
168
- $ this ->_storeData ();
167
+ if ($ this ->currentObjectID !== null ) {
168
+ $ this ->storeData ();
169
169
}
170
170
171
171
return parent ::getCellList ();
@@ -181,7 +181,7 @@ public function getCellList()
181
181
public function deleteCacheData ($ pCoord )
182
182
{
183
183
// Delete the entry from APC
184
- apc_delete ($ this ->_cachePrefix .$ pCoord .'.cache ' );
184
+ apc_delete ($ this ->cachePrefix .$ pCoord .'.cache ' );
185
185
186
186
// Delete the entry from our cell address array
187
187
parent ::deleteCacheData ($ pCoord );
@@ -199,24 +199,24 @@ public function copyCellCollection(PHPExcel_Worksheet $parent)
199
199
{
200
200
parent ::copyCellCollection ($ parent );
201
201
// Get a new id for the new file name
202
- $ baseUnique = $ this ->_getUniqueID ();
202
+ $ baseUnique = $ this ->getUniqueID ();
203
203
$ newCachePrefix = substr (md5 ($ baseUnique ), 0 , 8 ) . '. ' ;
204
204
$ cacheList = $ this ->getCellList ();
205
205
foreach ($ cacheList as $ cellID ) {
206
- if ($ cellID != $ this ->_currentObjectID ) {
207
- $ obj = apc_fetch ($ this ->_cachePrefix . $ cellID . '.cache ' );
206
+ if ($ cellID != $ this ->currentObjectID ) {
207
+ $ obj = apc_fetch ($ this ->cachePrefix . $ cellID . '.cache ' );
208
208
if ($ obj === false ) {
209
209
// Entry no longer exists in APC, so clear it from the cache array
210
210
parent ::deleteCacheData ($ cellID );
211
211
throw new PHPExcel_Exception ('Cell entry ' . $ cellID . ' no longer exists in APC ' );
212
212
}
213
- if (!apc_store ($ newCachePrefix . $ cellID . '.cache ' , $ obj , $ this ->_cacheTime )) {
213
+ if (!apc_store ($ newCachePrefix . $ cellID . '.cache ' , $ obj , $ this ->cacheTime )) {
214
214
$ this ->__destruct ();
215
215
throw new PHPExcel_Exception ('Failed to store cell ' . $ cellID . ' in APC ' );
216
216
}
217
217
}
218
218
}
219
- $ this ->_cachePrefix = $ newCachePrefix ;
219
+ $ this ->cachePrefix = $ newCachePrefix ;
220
220
}
221
221
222
222
/**
@@ -226,18 +226,18 @@ public function copyCellCollection(PHPExcel_Worksheet $parent)
226
226
*/
227
227
public function unsetWorksheetCells ()
228
228
{
229
- if ($ this ->_currentObject !== null ) {
230
- $ this ->_currentObject ->detach ();
231
- $ this ->_currentObject = $ this ->_currentObjectID = null ;
229
+ if ($ this ->currentObject !== null ) {
230
+ $ this ->currentObject ->detach ();
231
+ $ this ->currentObject = $ this ->currentObjectID = null ;
232
232
}
233
233
234
234
// Flush the APC cache
235
235
$ this ->__destruct ();
236
236
237
- $ this ->_cellCache = array ();
237
+ $ this ->cellCache = array ();
238
238
239
239
// detach ourself from the worksheet, so that it can then delete this object successfully
240
- $ this ->_parent = null ;
240
+ $ this ->parent = null ;
241
241
}
242
242
243
243
/**
@@ -250,10 +250,10 @@ public function __construct(PHPExcel_Worksheet $parent, $arguments)
250
250
{
251
251
$ cacheTime = (isset ($ arguments ['cacheTime ' ])) ? $ arguments ['cacheTime ' ] : 600 ;
252
252
253
- if ($ this ->_cachePrefix === null ) {
254
- $ baseUnique = $ this ->_getUniqueID ();
255
- $ this ->_cachePrefix = substr (md5 ($ baseUnique ), 0 , 8 ) . '. ' ;
256
- $ this ->_cacheTime = $ cacheTime ;
253
+ if ($ this ->cachePrefix === null ) {
254
+ $ baseUnique = $ this ->getUniqueID ();
255
+ $ this ->cachePrefix = substr (md5 ($ baseUnique ), 0 , 8 ) . '. ' ;
256
+ $ this ->cacheTime = $ cacheTime ;
257
257
258
258
parent ::__construct ($ parent );
259
259
}
@@ -266,7 +266,7 @@ public function __destruct()
266
266
{
267
267
$ cacheList = $ this ->getCellList ();
268
268
foreach ($ cacheList as $ cellID ) {
269
- apc_delete ($ this ->_cachePrefix . $ cellID . '.cache ' );
269
+ apc_delete ($ this ->cachePrefix . $ cellID . '.cache ' );
270
270
}
271
271
}
272
272
0 commit comments