Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
legi
soft
gestex
Commits
a5546959
Commit
a5546959
authored
Jul 15, 2021
by
Estéban Ristich
Browse files
Fix Issue
#62
Add SQL del recipe by id function
parent
1b87e3c1
Changes
1
Show whitespace changes
Inline
Side-by-side
module/db-functions.php
View file @
a5546959
...
...
@@ -1474,6 +1474,27 @@ function set_recipe_new($pdo, $equipment_id, $intervention_id, $file_field_name)
// ---------------------------------------------------------------------
function
del_recipe_by_id
(
$pdo
,
$id
)
{
$recipe_selected
=
get_recipe_all_by_id
(
$pdo
,
$id
);
$recipe_basepath
=
get_recipe_basepath
();
$recipe_pathname
=
$recipe_selected
[
'pathname'
];
$recipe_dirname
=
pathinfo
(
$recipe_pathname
,
PATHINFO_DIRNAME
);
if
(
is_file
(
$recipe_basepath
.
'/'
.
$recipe_pathname
))
$iostat
=
unlink
(
$recipe_basepath
.
'/'
.
$recipe_pathname
);
if
(
!
empty
(
$recipe_dirname
)
and
is_dir
(
$recipe_basepath
.
'/'
.
$recipe_dirname
))
$iostat
=
rmdir
(
$recipe_basepath
.
'/'
.
$recipe_dirname
);
$sql
=
'DELETE LOW_PRIORITY FROM recipe WHERE id = ? LIMIT 1;'
;
$stmt
=
$pdo
->
prepare
(
$sql
);
$iostat
=
$stmt
->
execute
(
array
(
$id
));
return
$iostat
;
}
// ---------------------------------------------------------------------
function
get_recipe_listall_by_equipment
(
$pdo
,
$equipment_id
)
{
$sql
=
'SELECT * FROM recipe WHERE equipment_id = ?;'
;
$stmt
=
$pdo
->
prepare
(
$sql
);
...
...
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