Skip to content

Commit

Permalink
fixes install and instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
luca committed Nov 30, 2015
1 parent 7ed3514 commit b1af782
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 17 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified documentation/images/edgesense_installed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added documentation/images/edgesense_run_the_script.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 10 additions & 2 deletions php/drupal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,19 @@ And save the configuration.

![enable edgesense views module](../../documentation/images/drupal_modules_edgesense.png)

During the install phase the module runs the script a first time, **this can take some time** but at the end of the install process you'll be greeted with a message that invites you to open the dashboard.
If the module has been activated correctly you will be shown this message:

![edgesense installed](../../documentation/images/edgesense_installed.png)

The default install uses the Drupal's cron to run the processing scripts once per day. If you have a big community and the Drupal's cron system times out while processing, you'll have to disable the automatic daily run from the Edgesense admin pages and you will have to schedule the runs with a different method (e.g. using the server system's cron scheduler)
During the install phase the module will **not** run the data processing script because **this can take a long time** for large communities and this would cause a timeout error during the install process. At the end of the module activation you'll be able to open the module admin page which will have a button to immediately run the data processing script. If your community is small then you can do it by clicking the "Run Now" button on the page.

![edgesense run the script](../../documentation/images/edgesense_run_the_script.png)

If you click that button and the script has run you'll see this message:

![edgesense dashboard ready](../../documentation/images/edgesense_dashboard_ready.png)

If you community site is big (e.g. more then 100 users, 300 nodes or 500 comments) you will need to run it using cron / drush to avoid timeouts. [See below for more detailed instructions on how to do so](https://github.com/Wikitalia/edgesense/tree/master/php/drupal#b-avoiding-timeouts).

## Appendix

Expand Down
15 changes: 8 additions & 7 deletions php/drupal/edgesense.admin.inc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function edgesense_admin_home_form($form, &$form_state) {
$text .= '<hr>';

if (!file_exists('public://edgesense/json/last.json')) {
$text .= '<p>The Edgsense Python script has not run yet. Please follow </p> ';
$text .= '<p>The Edgsense data processing script has not run yet. Please follow </p> ';
$text .= t('<a href="@url">the instructions</a> for running it.', array('@url' => url('admin/edgesense/script-run')));
$text .= '<hr>';
}
Expand Down Expand Up @@ -612,14 +612,15 @@ function edgesense_script_run_form($form, &$form_state) {
if (!file_exists('public://edgesense/json/last.json')) {
$form['first_run'] = array(
'#type' => 'fieldset',
'#title' => t('First Run'),
'#title' => t('Processing Script First Run'),
);
$form['first_run']['instructions'] = array(
'#markup' => t('The dashboard is almost ready, you will need to run the Edgesense Python script.<br/>
If your community is small enough then you can do it right now, by clicking the "Run Now" button below.<br/>
If it is big (e.g. more then 100 users, 300 nodes or 500 comments) you will need to run it using cron / drush
to avoid timeouts.<br/><br/>'),
'#markup' => t('The dashboard is almost ready, to analyse your community network, you will need to run the Edgesense data processing script.<br/>
If your community is small enough then you can do it right now, by clicking the "Run Now" button below.<br/><br/>
If it is <b>big</b> (e.g. more then 100 users, 300 nodes or 500 comments) to avoid timeout errors from Drupal you will need to
<a href="https://github.com/Wikitalia/edgesense/tree/master/php/drupal#b-avoiding-timeouts" target="_blank">run it using cron / drush</a>.<br/><br/>'),
);

$form['first_run']['run'] = array(
'#type' => 'submit',
'#value' => t('Run Now'),
Expand Down Expand Up @@ -677,7 +678,7 @@ function edgesense_script_run_form($form, &$form_state) {
*/
function edgesense_script_run_form_submit($form, &$form_state) {
edgesense_cron();
drupal_set_message(t('The Edgesense Python script has run successfully and your Dashboard is now ready.'));
drupal_set_message(t('The Edgesense data processing script has run successfully and your Dashboard is now ready.'));
}

function edgesense_open_dashboard() {
Expand Down
14 changes: 7 additions & 7 deletions php/drupal/edgesense.install
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@ function edgesense_install() {
// Run the script for the first time to populate the dashboard
// checks also if the script is present and that it has actually run
if (!`which edgesense_drupal`) {
drupal_set_message(t('The Edgsense Python script has not been installed. Please follow ' .
drupal_set_message(t('The Edgsense data processing script has not been installed. Please follow ' .
'<a href="https://github.com/Wikitalia/edgesense/tree/master/python" target="_blank">the instructions</a> for installing it.'
),
'warning'
);
}

drupal_set_message(t('The Edgsense modules has been installed but the Python script has not run yet. Please follow ' .
'<a href="@url">the instructions</a> for running it.', array('@url' => url('admin/edgesense/script-run'))
drupal_set_message(t('The Edgsense module has been installed. You are one small step away form using your dashboard: the data processing script needs to run. Please ' .
'<a href="@url">click here and follow the instruction</a> for executing it.', array('@url' => url('admin/edgesense/script-run'))
));
}

Expand All @@ -108,19 +108,19 @@ function edgesense_requirements($phase) {
elseif ($phase == 'runtime') {
if (!`which edgesense_drupal`) {
$requirements['edgesense_drupal'] = array(
'title' => $t('Edgesense Python script'),
'title' => $t('Edgesense data processing script'),
'value' => $t('Not installed'),
'description' => $t('The Edgsense Python script has not been installed. Please follow ' .
'description' => $t('The Edgsense data processing script has not been installed. Please follow ' .
'<a href="https://github.com/Wikitalia/edgesense/tree/master/python" target="_blank">the instructions</a> for installing it.'
),
'severity' => REQUIREMENT_ERROR,
);
}
elseif (!file_exists('public://edgesense/json/last.json')) {
$requirements['edgesense_drupal'] = array(
'title' => $t('Edgesense Python script'),
'title' => $t('Edgesense data processing script'),
'value' => $t('Not run'),
'description' => $t('The Edgsense Python script has not run yet. Please follow ' .
'description' => $t('The Edgsense data processing script has not run yet. Please follow ' .
'<a href="@url">the instructions</a> for running it.', array('@url' => url('admin/edgesense/script-run'))
),
'severity' => REQUIREMENT_WARNING,
Expand Down
2 changes: 1 addition & 1 deletion php/drupal/edgesense.module
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ function edgesense_cron() {
*/
function edgesense_display_not_run_message() {
if (!file_exists('public://edgesense/json/last.json')) {
drupal_set_message(t('The Edgsense Python script has not run yet. Please follow ' .
drupal_set_message(t('The Edgsense data processing script has not run yet. Please follow ' .
'<a href="@url">the instructions</a> for running it.', array('@url' => url('admin/edgesense/script-run'))
), 'warning');
}
Expand Down

0 comments on commit b1af782

Please sign in to comment.