Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
Nuovo sito - PHP
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
37
Issues
37
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gruppo Web
Nuovo sito - PHP
Commits
dbe1672f
Commit
dbe1672f
authored
Jul 15, 2014
by
Pietro Albini
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'scrumb_scripts' of code.ubuntu-it.org:ubuntu-it-web/www-test into scrumb_scripts
parents
38ee677a
a0e7d284
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
15 deletions
+18
-15
scripts/scrub.sql
scripts/scrub.sql
+5
-2
scripts/sql_scrub_dump.sh
scripts/sql_scrub_dump.sh
+13
-13
No files found.
scr
um
b.sql
→
scr
ipts/scru
b.sql
View file @
dbe1672f
...
...
@@ -32,11 +32,14 @@
-- So we truncate the table and insert a new admin user with pass admin
TRUNCATE
drupal_users
;
INSERT
INTO
drupal_users
(
uid
,
name
,
pass
,
mail
,
timezone
,
language
,
status
,
init
)
VALUES
(
1
,
"admin"
,
"434c3264048726754ee0e07e508d867e"
,
"admin@localhost"
,
"Europe/Berlin"
,
"it"
,
1
,
"admin@localhost"
);
VALUES
(
1
,
'admin'
,
'434c3264048726754ee0e07e508d867e'
,
'admin@localhost'
,
'Europe/Berlin'
,
'it'
,
1
,
'admin@localhost'
);
-- Turnoff modules
DELETE
FROM
drupal_system
WHERE
name
IN
(
'tweet_button'
,
'openid_test'
,
'openid_launchpad'
,
'openid_teams'
,
'googleanalytics'
,
'google_plusone'
,
'openid'
,
'fblikebutton'
,
'disqus'
);
-- Delete emails from comments
UPDATE
drupal_comment
SET
name
=
'Anonymous'
,
mail
=
'anonymous@localhost'
,
homepage
=
'http://www.ubuntu-it.org'
WHERE
uid
=
0
;
-- Truncate tables with sensitive data
TRUNCATE
drupal_authmap
;
TRUNCATE
drupal_cache
;
...
...
s
ql_scrum
b_dump.sh
→
s
cripts/sql_scru
b_dump.sh
100644 → 100755
View file @
dbe1672f
...
...
@@ -6,6 +6,8 @@
# You need a file named 'scrub.sql' with querys to scrub the db
#
# Use as ./sql_scrub_dump.sh dump_file_input.tar.gz dump_file_output.tar.gz
# Of course you need to launch it with a user which has a role to create
# database in Postgresql
#
# The input and the output dump have to be .tar.gz.
#
...
...
@@ -25,26 +27,24 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Some params
local_db
=
temp_scrub
local_user
=
${
1
}
local_pass
=
${
2
}
dump_input
=
${
3
}
dump_output
=
${
4
}
local_db
=
'temp_scrub'
dump_input
=
${
1
}
dump_output
=
${
2
}
# Destroy previous temp database and create a new one
dropdb
--if-exists
$local_db
createdb
$local_db
dropdb
--if-exists
"
$local_db
"
createdb
"
$local_db
"
# Extract the file and import in psql
gunzip
-c
$dump_input
|
tar
xvf - | psql
$local_db
tar
-xOvf
"
$dump_input
"
| psql
"
$local_db
"
# Scrub the database
psql
$local_db
< scrub.sql
psql
"
$local_db
"
< scrub.sql
# E
s
port the db
pg_dump
$local_db
>
scrubbed-db.sql
tar
-cvzf
$dump_output
scrubbed-db.sql
# E
x
port the db
pg_dump
"
$local_db
"
>
scrubbed-db.sql
tar
-cvzf
"
$dump_output
"
scrubbed-db.sql
# Removed temporary files
dropdb
--if-exists
$local_db
dropdb
--if-exists
"
$local_db
"
rm
-f
scrubbed-db.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