ASNMTAP

 view release on metacpan or  search on metacpan

applications/htmlroot/cgi-bin/admin/generateConfig.pl  view on Meta::CPAN

	    if ( defined $numberCatalogCentralServers and $numberCatalogCentralServers != 1 ) {
          $countErrors++;
          $matchingErrors .= "<tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>$numberCatalogCentralServers</td><td>there can be only one activated central monitoring server into the catalog</td><td>&nbsp;</td></tr>";
        }
      }

      # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

      $matchingWarnings .= "<tr bgcolor=\"$COLORSTABLE{TABLE}\"><td align=\"center\" colspan=\"3\">&nbsp;</td></tr>";

      # plugins uploaded <-> plugins configurated - - - - - - - - - - - -
      $matchingWarnings .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td align=\"center\" colspan=\"3\">Plugins Uploaded <-> Plugins Configurated</td></tr><tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td>Plugin</td><td>Message</td><td align=\"center\">Acti...
      $sql = "SELECT DISTINCT test FROM $SERVERTABLPLUGINS where catalogID = '$CATALOGID' and activated = 1";
      $sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
      $sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
      $sth->bind_columns( \$test) or $rv = error_trap_DBI(*STDOUT, "Cannot sth->bind_columns: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;

      if ( $rv ) {
        if ( $sth->rows ) {
          my @plugins = glob("$PLUGINPATH/*.pl");

          while( $sth->fetch() ) {
            my $teller = 0;

            foreach my $plugin (@plugins) {
              if ( defined $plugin and defined $test and $plugin eq "$PLUGINPATH/$test" ) {
                $plugins[$teller] = undef;
                last;
              }

              $teller++
            }
          }

          foreach my $pluginPath (@plugins) {
            if (defined $pluginPath) {
		      (undef, my $plugin) = split (/^$PLUGINPATH\//, $pluginPath);
              $actionItem = "<a href=\"$urlWithAccessParameters&amp;action=updateView&amp;plugin=$plugin&amp;todo=delete\" target=\"_blank\"><img src=\"$IMAGESURL/$ICONSRECORD{delete}\" title=\"Delete Plugin\" alt=\"Delete Plugin\" border=\"0\"></a>"...
              $matchingWarnings .= "<tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>$plugin</td><td>plugin uploaded without plugin configuration</td><td align=\"center\">$actionItem</td></tr>";
              $countWarnings++;
			}
          }
        }

        $sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
      }

      # plugins configurated <-> plugins uploaded - - - - - - - - - - - -
      $matchingWarnings .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td align=\"center\" colspan=\"3\">Plugins Configurated <-> Plugins Uploaded</td></tr><tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td>Plugin</td><td>Message</td><td align=\"center\">Acti...
      $matchingErrors .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td align=\"center\" colspan=\"3\">Plugins Configurated <-> Plugins Uploaded</td></tr><tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td>Plugin</td><td>Message</td><td align=\"center\">Action...

      $sql = "SELECT DISTINCT test FROM $SERVERTABLPLUGINS where catalogID = '$CATALOGID' and activated = 1";
      $sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
      $sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
      $sth->bind_columns( \$test) or $rv = error_trap_DBI(*STDOUT, "Cannot sth->bind_columns: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;

      if ( $rv ) {
        if ( $sth->rows ) {
          while( $sth->fetch() ) {
            if (! -e "$PLUGINPATH/$test") {
              $actionItem = "<a href=\"$urlWithAccessParameters&amp;action=updateView&amp;plugin=$test&amp;todo=edit\" target=\"_blank\"><img src=\"$IMAGESURL/$ICONSRECORD{edit}\" title=\"Edit Plugin\" alt=\"Edit Plugin\" border=\"0\"></a>";
              $matchingWarnings .= "<tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>$test</td><td>plugin configuration without plugin uploaded</td><td align=\"center\">$actionItem</td></tr>";
              $countWarnings++;
            } else {
               my $sb = stat("$PLUGINPATH/$test");

               unless ( $sb->mode == 33261 or $sb->mode == 33256 ) { # 0755 = 33261 & 0750 = 33256 
                $actionItem = "<a href=\"$urlWithAccessParameters&amp;action=updateView&amp;plugin=$test&amp;todo=maintenance\" target=\"_blank\"><img src=\"$IMAGESURL/$ICONSRECORD{maintenance}\" title=\"Rights Plugin\" alt=\"Rights Plugin\" border=\...
                $matchingErrors .= "<tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>$test</td><td>plugin configuration with plugin uploaded but without wanted excecution rights</td><td align=\"center\">$actionItem</td></tr>";
                $countErrors++;
              }
            }
          }
        }

        $sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
      }

      # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

      $matchingWarnings .= "<tr bgcolor=\"$COLORSTABLE{TABLE}\"><td align=\"center\" colspan=\"3\">&nbsp;</td></tr>";

      # help plugin filenames <-> plugin  - - - - - - - - - - - - - - - -
      $matchingWarnings .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td align=\"center\" colspan=\"3\">Help Plugin Filenames <-> Plugin</td></tr><tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td>Help Plugin Filename</td><td>Message</td><td align=\"center\"...
      $sql = "SELECT DISTINCT helpPluginFilename FROM $SERVERTABLPLUGINS WHERE catalogID = '$CATALOGID' and helpPluginFilename != '<NIHIL>'";
      $sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
      $sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
      $sth->bind_columns( \$helpPluginFilename) or $rv = error_trap_DBI(*STDOUT, "Cannot sth->bind_columns: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;

      if ( $rv ) {
        if ( $sth->rows ) {
          my @helpPluginFilenames = glob("$PDPHELPPATH/*");

          while( $sth->fetch() ) {
            my $teller = 0;

            foreach my $helpPluginPathFilename (@helpPluginFilenames) {
              if ( $helpPluginPathFilename eq "$PDPHELPPATH/$helpPluginFilename" ) {
                $helpPluginFilenames[$teller] = undef;
                last;
              }

              $teller++
            }
          }

          foreach my $helpPluginPathFilename (@helpPluginFilenames) {
            if (defined $helpPluginPathFilename) {
		      (undef, $helpPluginFilename) = split (/^$PDPHELPPATH\//, $helpPluginPathFilename);
              $actionItem = "<a href=\"$urlWithAccessParameters&amp;action=updateView&amp;helpPluginFilename=$helpPluginFilename&amp;todo=delete\" target=\"_blank\"><img src=\"$IMAGESURL/$ICONSRECORD{delete}\" title=\"Delete Help Plugin Filename\" al...
              $matchingWarnings .= "<tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>$helpPluginFilename</td><td>help plugin filename without plugin reference</td><td align=\"center\">$actionItem</td></tr>";
              $countWarnings++;
			}
          }
        }

        $sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
      }

      # plugins <-> help plugin filename  - - - - - - - - - - - - - - - -
      $matchingWarnings .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td align=\"center\" colspan=\"3\">Plugins <-> Help Plugin Filename</td></tr><tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td>Unique Key</td><td>Message</td><td align=\"center\">Action</t...
      $sql = "SELECT uKey, LTRIM(SUBSTRING_INDEX(title, ']', -1)) as shortTitle, helpPluginFilename FROM $SERVERTABLPLUGINS WHERE catalogID = '$CATALOGID' and activated = 1 order by shortTitle";
      $sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
      $sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
      $sth->bind_columns( \$warning, \$title, \$helpPluginFilename) or $rv = error_trap_DBI(*STDOUT, "Cannot sth->bind_columns: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;

      if ( $rv ) {
        if ( $sth->rows ) {
          while( $sth->fetch() ) {
            if (! defined $helpPluginFilename or $helpPluginFilename eq '<NIHIL>') {
              $actionItem = "<a href=\"$urlWithAccessParameters&amp;action=updateView&amp;helpPluginFilename=<NIHIL>&amp;todo=duplicate\" target=\"_blank\"><img src=\"$IMAGESURL/$ICONSRECORD{duplicate}\" title=\"Add Help Plugin Filename\" alt=\"Add H...
              $matchingWarnings .= "<tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>$warning</td><td>'$title' plugin without help plugin filename defined</td><td align=\"center\">$actionItem</td></tr>";
              $countWarnings++;
            } elsif ($helpPluginFilename !~ /^http(s)?\:\/\// and ! -e "$PDPHELPPATH/$helpPluginFilename") {
              $actionItem = "<a href=\"$urlWithAccessParameters&amp;action=updateView&amp;helpPluginFilename=$helpPluginFilename&amp;todo=edit\" target=\"_blank\"><img src=\"$IMAGESURL/$ICONSRECORD{edit}\" title=\"Edit Help Plugin Filename\" alt=\"Ed...
              $matchingWarnings .= "<tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>$warning</td><td>'$title' plugin with missing help plugin filename '<b>$helpPluginFilename</b>'</td><td align=\"center\">$actionItem</td></tr>";
              $countWarnings++;
            }
          }
        }

        $sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
      }

      # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

      $matchingErrors .= "</table>\n";
      $matchingWarnings .= "</table>\n";

      # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

      if ($action eq 'generateView') {
        my ($rvOpen, $typeMonitoringCharDorC, $typeMonitoring, $typeServers, $typeActiveServer, $masterFQDN, $masterASNMTAP_PATH, $masterRSYNC_PATH, $masterSSH_PATH, $slaveFQDN, $slaveASNMTAP_PATH, $slaveRSYNC_PATH, $slaveSSH_PATH, $mode, $dumphttp, ...

        $initializeGenerateView .= "\n      <table width=\"100%\" align=\"center\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\" bgcolor=\"$COLORSTABLE{TABLE}\">\n        <tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><th>Initialize Generate Configs</th></...

        $initializeGenerateView .= system_call ("mkdir",  "$APPLICATIONPATH/tmp", $debug);
        $initializeGenerateView .= system_call ("mkdir",  "$APPLICATIONPATH/tmp/$CONFIGDIR", $debug);
        $initializeGenerateView .= system_call ("rm -rf", "$APPLICATIONPATH/tmp/$CONFIGDIR/generated", $debug);
        $initializeGenerateView .= system_call ("mkdir",  "$APPLICATIONPATH/tmp/$CONFIGDIR/generated", $debug);

        unless (-d "$APPLICATIONPATH/tmp/$CONFIGDIR/installed") {
          $initializeGenerateView .= system_call ("mkdir",  "$APPLICATIONPATH/tmp/$CONFIGDIR/installed", $debug);
        }

        if ( defined $numberCentralServers and $numberCentralServers == 1) {
          $initializeGenerateView .= system_call ("mkdir",  "$APPLICATIONPATH/tmp/$CONFIGDIR/generated/CM-$centralTypeActiveServer-$centralMasterFQDN", $debug);
          $initializeGenerateView .= system_call ("mkdir",  "$APPLICATIONPATH/tmp/$CONFIGDIR/generated/CM-$centralTypeActiveServer-$centralMasterFQDN/etc", $debug);
          $initializeGenerateView .= system_call ("mkdir",  "$APPLICATIONPATH/tmp/$CONFIGDIR/generated/CM-$centralTypeActiveServer-$centralMasterFQDN/master", $debug);

		  if ( $centralTypeServers ) {
            $initializeGenerateView .= system_call ("mkdir", "$APPLICATIONPATH/tmp/$CONFIGDIR/generated/CS-$centralTypeActiveServer-$centralSlaveFQDN", $debug);
            $initializeGenerateView .= system_call ("mkdir", "$APPLICATIONPATH/tmp/$CONFIGDIR/generated/CS-$centralTypeActiveServer-$centralSlaveFQDN/etc", $debug);
            $initializeGenerateView .= system_call ("mkdir", "$APPLICATIONPATH/tmp/$CONFIGDIR/generated/CS-$centralTypeActiveServer-$centralSlaveFQDN/master", $debug);
          }
        }

        $initializeGenerateView .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td><a href=\"/$CONFIGDIR/generated/\" target=\"_blank\">Browse directory list with all config files</a></td></tr>\n      </table>";

        my $configDateTime = get_csvfiledate .' '. get_csvfiletime;
        $rvOpen = 0;

        # ArchiveCT - - - - - - - - - - - - - - - - - - - - - - - - - - -
        $sql = "select distinct $SERVERTABLSERVERS.serverID, $SERVERTABLSERVERS.typeMonitoring, $SERVERTABLSERVERS.typeServers, $SERVERTABLSERVERS.typeActiveServer, $SERVERTABLSERVERS.masterFQDN, $SERVERTABLSERVERS.masterASNMTAP_PATH, $SERVERTABLSERV...
        $sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
        $sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
        $sth->bind_columns( \$serverID, \$typeMonitoring, \$typeServers, \$typeActiveServer, \$masterFQDN, \$masterASNMTAP_PATH, \$masterRSYNC_PATH, \$masterSSH_PATH, \$slaveFQDN, \$slaveASNMTAP_PATH, \$slaveRSYNC_PATH, \$slaveSSH_PATH, \$collectorDa...

        if ( $rv ) {
          $matchingArchiveCT .= "\n      <table width=\"100%\" align=\"center\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\" bgcolor=\"$COLORSTABLE{TABLE}\">";

          if ( $sth->rows ) {
            $prevTypeServers = $prevTypeActiveServer = 0;
            $prevServerID = $prevMasterFQDN = $prevMasterASNMTAP_PATH = $prevMasterRSYNC_PATH = $prevMasterSSH_PATH = $prevSlaveFQDN = $prevSlaveASNMTAP_PATH = $prevSlaveRSYNC_PATH = $prevSlaveSSH_PATH = $prevResultsdir = '';



( run in 0.854 second using v1.01-cache-2.11-cpan-39bf76dae61 )