Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Comptoir
Comptoir-srv
Commits
9767ba67
Commit
9767ba67
authored
May 26, 2021
by
Fabrice Gangler
🎨
Browse files
FIX: update SILL import script
parent
9654eabd
Pipeline
#15721
failed with stage
in 5 minutes and 1 second
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Documentation/For_developers/Features/SILL/2020/prepare_SQL.php
View file @
9767ba67
...
...
@@ -18,22 +18,23 @@ $url = "https://raw.githubusercontent.com/DISIC/sill/master/2020/sill-2020.csv";
$fileName
=
'SILL_2020.csv'
;
$dataSrc
=
file_get_contents
(
$url
);
file_put_contents
(
$fileName
,
$dataSrc
);
/* [0] => ID
[1] => nom
[2] => fonction
[3] => annees
[4] => statut
[5] => parent
[6] => public
[7] => similaire-a
[8] => wikidata
[9] => comptoir-du-libre
[10] => licence */
[1] => nom
[2] => fonction
[3] => annees
[4] => statut
[5] => parent
[6] => public
[7] => support
[8] => similaire-a
[9] => wikidata
[10] => comptoir-du-libre
[11] => licence */
// column numbers of the csv file
$numberOfFileFields
=
1
6
;
$numberOfFileFields
=
1
7
;
$colYears
=
3
;
$colWikidata
=
8
;
$colComptoir
=
9
;
$colWikidata
=
9
;
$colComptoir
=
10
;
// file processing
$row
=
1
;
...
...
@@ -68,8 +69,11 @@ if (($handle = fopen($fileName, "r")) !== false) {
$idWikidata
=
$data
[
$colWikidata
];
$lineYears
=
explode
(
';'
,
$data
[
$colYears
]);
foreach
(
$lineYears
as
$year
)
{
$year
=
(
int
)
trim
(
$year
);
$years
[
$year
][
$idComptoir
]
=
$idWikidata
;
$year
=
trim
(
$year
);
if
(
$year
!==
''
)
{
$year
=
(
int
)
$year
;
$years
[
$year
][
$idComptoir
]
=
$idWikidata
;
}
}
}
else
{
$noIds
[
$row
]
=
$data
;
...
...
@@ -100,6 +104,7 @@ echo "\n------> ". ($row - 1) . " src";
echo
"
\n
------> "
.
(
count
(
$noIds
)
-
1
)
.
" NO id comptoir"
;
foreach
(
$years
as
$year
=>
$Ids
)
{
echo
"
\n
------> "
.
count
(
$Ids
)
.
" software for SILL-
$year
"
;
// print_r($Ids);
}
echo
"
\n\n
"
;
...
...
Write
Preview
Supports
Markdown
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