There is a service Yandex Site search Pinger (http://site.yandex.ru). This is a service that allows you to create search on the site or group of sites. For this service it is necessary that the site has been indexed by Yandex. Robots Yandex self-index the site. However, apart from the core of the index when searching the site uses an additional index, specially built for such sites. You can increase the priority of indexing certain pages of the site with the help of the plug-in Yandex Site search Pinger, which sends requests to the indexing automatically. This plug-in installed in a CMS, monitors changes to the site and generates requests for indexing all new or modified documents.

Basic information on what the plugin-pinger is described on page http://help.yandex.ru/site/?id=1125183. How to configure the plugin for Drupal is described here http://help.yandex.ru/site/?id=1125174 and here http://help.yandex.ru/site/?id=1125175. Files of plugins and the basic information for the user is located here: http://site.yandex.ru/cms-plugins/

This module works with Drupal 5, 6 and 7.

Repo http://drupalcode.org/sandbox/yandex-plugins/1937972.git

Reviews of other projects:
http://drupal.org/node/1969772#comment-7405360
http://drupal.org/node/1992712#comment-7405518
http://drupal.org/node/1992452#comment-7405574

Comments

likebtn’s picture

Could you, please, specify correct Git link in the issue: http://git.drupal.org/sandbox/yandex-plugins/1937972.git
and provide a Project link (http://drupal.org/sandbox/yandex-plugins/1937972)

likebtn’s picture

Results of the automatic review: http://ventral.org/pareview/httpgitdrupalorgsandboxyandex-plugins1937972git
Take a look at them.

Manual review:
1) yandex_pinger.install
- Line 52. The following

if ($settings = init_settings()) {
    variable_set($prefix . 'key', $settings['key']);
    variable_set($prefix . 'login', $settings['login']);
    variable_set($prefix . 'searchId', $settings['searchId']);
    variable_set($prefix . 'message', $settings['message']);
    variable_set($prefix . 'pluginId', $settings['pluginId']);
  }

can be replaced with the foreach () through $settings.

2) yandex_pinger.module
- Looks like this plugin has all the messages in Russian and is not supposed to be translated into other languages. What about mentioning it on the Project Page: http://drupal.org/sandbox/yandex-plugins/1937972
Otherwise you should write all the messages in English and use t() function to translate them.
- Consider justifying tabs and indents of the arrays (Line 70, 229 and so on)

klausi’s picture

We are currently quite busy with all the project applications and I can only review projects with a review bonus. Please help me reviewing and put yourself on the PAReview: review bonus high priority list. Then I'll take a look at your project right away :-)

yandex-plugins’s picture

Hello!

Thank you for reviews. We was finished foreach() optimisation, translate module into English & fix codestyle.
All version of module was tested by coder module in enviroments:
- Ubuntu 8, PHP 5.2.x for D5, D6
- Ubuntu 12, PHP 5.4.x for D7

but automatic review by http://ventral.org site showing some errors. What system should we believe?

he0x410’s picture

Hi,

You should follow http://ventral.org, because Coder module is not PAReview.sh, which is required by klausi.

Manual code review:

README.txt is not in right format.

yandex_pinger.info:
These two lines used in wrong way, install and module files includes by default, files array in info should include only additional, so you don't have to do module_load_include
files[]= yandex_pinger.install
files[]= yandex_pinger.module

yandex_pinger.install

  1. function _yandex_pinger_init_settings:
    • using settings.ini in module folder for user settings - is not the way you should
      provide configuration, because in most cases they are using repositories and
      files in contributed modules can not be modified at all. I suggest you to implement
      configuration page, after module installation. - In case if this is not possible: provide
      users instructions, so they can set all required variables in settings.php using $conf.
    • It is not recommended to use "throw new Exception" in module install. Use standard drupal error handling in module install.
  2. Why do you need to create custom menu with name "Development" (which is already exists in most cases) @line73?

yandex_pinger.module

  1. In function _yandex_pinger_doping@57, which is called each time any node is inserted or updated: you use "throw new Exception("unable to write");", "throw new Exception("unable to create socket");", etc... , in case if there is any problem with connection to the server. - it will prevent user from update and make them confused. Use drupal_set_message and watchdog.
  2. Is there any reason to use fsockopen function instead of curl to get a response from third-party service?
  3.    $postdata = array(
        'key' => variable_get($prefix . 'key', ''),
        'login' => variable_get($prefix . 'login', ''),
        'search_id' => variable_get($prefix . 'searchId', ''),
        'pluginid' => variable_get($prefix . 'pluginId', ''),
        'urls' => $url,
        'publishdate' => 0,
        'cmsver' => VERSION,
      );
    
      $tarr = array();
    
      foreach ($postdata as $key => $val) {
        $tarr[] = $key . '=' . $val;
      }
    
      $postdata = implode('&', $postdata);
      unset($tarr);
    

    Can be revised with this:

    $postdata = array(
        'key' => variable_get($prefix . 'key', ''),
        'login' => variable_get($prefix . 'login', ''),
        'search_id' => variable_get($prefix . 'searchId', ''),
        'pluginid' => variable_get($prefix . 'pluginId', ''),
        'urls' => $url,
        'publishdate' => 0,
        'cmsver' => VERSION,
      );
      $postdata = http_build_query($postdata);
    

    http://www.php.net/http_build_query

Also I'd recommend to add ability for user to specify which content type of nodes they would ping in yandex.

Good luck!

yandex-plugins’s picture

Hi,

Artem, thank you for review. We are left exceptions because all of they catching & can't cause issue for user. We was added watchdog() also.

We use sockets, because CURL didn't installed by default in our development environment.

We was do next changes:

  • Added ability for user to specify which content type of nodes they would ping in Yandex on settings page
  • Removed custom menu
  • Removed settings.ini & add instruction to README.txt for configure module variables from settings.php
  • Fixed codestyle in all branches with using PAReview.sh validator

If all alright, please grant to our module full project status. So we can work more effective with Drupal community.

he0x410’s picture

Hi again,

Regarding curl or sockets - you can use http://api.drupal.org/api/drupal/includes!common.inc/function/drupal_htt... function, it uses sockets I believe.

I'm just a reviewer, who went thru Bonus Review process, like others, and do not have permission to grant access for promoting full projects :)
If you want to be reviewed by responsible person, you would like to read this article http://drupal.org/node/1410826

yandex-plugins’s picture

Status: Needs review » Reviewed & tested by the community
patrickd’s picture

Status: Reviewed & tested by the community » Needs work
  • First of all - do not RTBC your own applications.
  • Furthermore, why don't you make use of drupal_http_request() for doing the ping? There seems to be nothing special about it.
  • "Initializing" settings is a bad practice in Drupal 6 and 7, please don't do that.
  • Do not change your modules weight by altering the system table in drupal 7 - use hook_module_implements_alter()
  • Don't overwrite the existing settings when the module is re-enabled by calling the install functions - that makes no sense.

I understand that you try to make the module easily maintainable over all drupal core versions by using similar API's and code. BUT that's not the way drupal works.

Drupal is driven by innovation. If there are new and easier API functions ->>> USE them.

PA robot’s picture

Status: Needs work » Closed (won't fix)

Closing due to lack of activity. Feel free to reopen if you are still working on this application.

I'm a robot and this is an automated message from Project Applications Scraper.

PA robot’s picture

Issue summary: View changes

Fix repo path, add links to reviewed projects