Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
test-project
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Junaid Rahman pv
test-project
Commits
64a9a39e
Commit
64a9a39e
authored
Sep 21, 2016
by
jomon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
app/drop-db commend added
parent
010258b8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
+12
-0
AppController.php
console/controllers/AppController.php
+12
-0
No files found.
console/controllers/AppController.php
View file @
64a9a39e
...
@@ -82,9 +82,21 @@ class AppController extends Controller
...
@@ -82,9 +82,21 @@ class AppController extends Controller
$content
=
preg_replace_callback
(
'/<generated_key>/'
,
function
()
{
$content
=
preg_replace_callback
(
'/<generated_key>/'
,
function
()
{
$length
=
32
;
$length
=
32
;
$bytes
=
openssl_random_pseudo_bytes
(
32
,
$cryptoStrong
);
$bytes
=
openssl_random_pseudo_bytes
(
32
,
$cryptoStrong
);
return
strtr
(
substr
(
base64_encode
(
$bytes
),
0
,
$length
),
'+/'
,
'_-'
);
return
strtr
(
substr
(
base64_encode
(
$bytes
),
0
,
$length
),
'+/'
,
'_-'
);
},
$content
);
},
$content
);
file_put_contents
(
$file
,
$content
);
file_put_contents
(
$file
,
$content
);
}
}
}
}
public
function
actionDropDb
()
{
$db
=
Yii
::
$app
->
db
;
$db
->
createCommand
(
"SET foreign_key_checks = 0;"
)
->
execute
();
foreach
(
$db
->
schema
->
tableNames
as
$table
)
{
Console
::
output
(
"Droping:
{
$table
}
"
);
$db
->
createCommand
(
"DROP TABLE
{
$table
}
"
)
->
execute
();
}
$db
->
createCommand
(
"SET foreign_key_checks = 1;"
)
->
execute
();
}
}
}
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