Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
qfq
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
typo3
qfq
Commits
a1cc0200
Commit
a1cc0200
authored
8 years ago
by
Carsten Rose
Browse files
Options
Downloads
Patches
Plain Diff
Delete: fixed that files not automatically deleted.
Delete.php: chdir to the correct directory before starting to delete files
parent
9efd27f5
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
extension/qfq/qfq/Delete.php
+18
-1
18 additions, 1 deletion
extension/qfq/qfq/Delete.php
with
18 additions
and
1 deletion
extension/qfq/qfq/Delete.php
+
18
−
1
View file @
a1cc0200
...
@@ -10,6 +10,7 @@ namespace qfq;
...
@@ -10,6 +10,7 @@ namespace qfq;
require_once
(
__DIR__
.
'/Constants.php'
);
require_once
(
__DIR__
.
'/Constants.php'
);
require_once
(
__DIR__
.
'/Database.php'
);
require_once
(
__DIR__
.
'/Database.php'
);
require_once
(
__DIR__
.
'/store/Store.php'
);
class
Delete
{
class
Delete
{
...
@@ -18,11 +19,17 @@ class Delete {
...
@@ -18,11 +19,17 @@ class Delete {
*/
*/
private
$db
=
null
;
private
$db
=
null
;
/**
* @var Store
*/
private
$store
=
null
;
/**
/**
*
*
*/
*/
public
function
__construct
()
{
public
function
__construct
(
$phpUnit
=
false
)
{
$this
->
db
=
new
Database
();
$this
->
db
=
new
Database
();
$this
->
store
=
Store
::
getInstance
(
''
,
$phpUnit
);
}
}
/**
/**
...
@@ -36,6 +43,7 @@ class Delete {
...
@@ -36,6 +43,7 @@ class Delete {
* @return bool
* @return bool
* @throws CodeException
* @throws CodeException
* @throws DbException
* @throws DbException
* @throws UserFormException
*/
*/
public
function
process
(
array
$form
,
$recordId
,
array
&
$msg
)
{
public
function
process
(
array
$form
,
$recordId
,
array
&
$msg
)
{
$rc
=
false
;
$rc
=
false
;
...
@@ -49,6 +57,13 @@ class Delete {
...
@@ -49,6 +57,13 @@ class Delete {
throw
new
CodeException
(
'Invalid record id'
,
ERROR_MISSING_RECORD_ID
);
throw
new
CodeException
(
'Invalid record id'
,
ERROR_MISSING_RECORD_ID
);
}
}
// Take care the necessary target directories exist.
$cwd
=
getcwd
();
$sitePath
=
$this
->
store
->
getVar
(
SYSTEM_SITE_PATH
,
STORE_SYSTEM
);
if
(
$cwd
===
false
||
$sitePath
===
false
||
!
chdir
(
$sitePath
))
{
throw
new
UserFormException
(
"getcwd() failed or SITE_PATH undefined or chdir('
$sitePath
') failed."
,
ERROR_IO_CHDIR
);
}
// Read record first.
// Read record first.
$row
=
$this
->
db
->
sql
(
"SELECT * FROM "
.
$form
[
F_TABLE_NAME
]
.
" WHERE id=?"
,
ROW_EXPECT_0_1
,
[
$recordId
]);
$row
=
$this
->
db
->
sql
(
"SELECT * FROM "
.
$form
[
F_TABLE_NAME
]
.
" WHERE id=?"
,
ROW_EXPECT_0_1
,
[
$recordId
]);
if
(
count
(
$row
)
>
0
)
{
if
(
count
(
$row
)
>
0
)
{
...
@@ -83,6 +98,8 @@ class Delete {
...
@@ -83,6 +98,8 @@ class Delete {
$msg
[
MSG_ERROR_CODE
]
=
ERROR_RECORD_NOT_FOUND
;
$msg
[
MSG_ERROR_CODE
]
=
ERROR_RECORD_NOT_FOUND
;
}
}
chdir
(
$cwd
);
return
$rc
;
return
$rc
;
}
}
}
}
\ No newline at end of file
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