caches.tpl.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <?php
  2. /* Copyright (C) 2014-2022 Regis Houssin <regis.houssin@inodbox.com>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. *
  17. */
  18. // Protection to avoid direct call of template
  19. if (empty($conf) || !is_object($conf)) {
  20. print "Error, template page can't be called as URL";
  21. exit;
  22. }
  23. global $form;
  24. ?>
  25. <!-- START PHP TEMPLATE ADMIN CACHES -->
  26. <div class="table-border centpercent">
  27. <div class="table-border-row oddeven">
  28. <div class="tagtd padding-left5 seventy-percent" align="left"><b><?php echo $langs->trans("MulticompanySession"); ?></b><br><i><?php echo $langs->trans('MulticompanySessionDescription'); ?></i><br><br></div>
  29. <div class="tagtd valign-middle text-align-left">
  30. <div class="float-left"></div>
  31. </div>
  32. <div class="tagtd valign-middle button-align-right">
  33. <?php
  34. $input = array(
  35. 'del' => array('MULTICOMPANY_MEMCACHED_ENABLED','MULTICOMPANY_SHMOP_ENABLED'),
  36. 'disabled' => array('MULTICOMPANY_MEMCACHED_SERVER')
  37. );
  38. echo ajax_mcconstantonoff('MULTICOMPANY_SESSION_ENABLED', $input, 0);
  39. ?>
  40. </div>
  41. </div>
  42. </div>
  43. <div class="table-border centpercent">
  44. <div class="table-border-row oddeven">
  45. <div class="tagtd padding-left5 seventy-percent" align="left"><b><?php echo $langs->trans("MulticompanyMemcached"); ?></b><br><i><?php echo $langs->trans('MulticompanyMemcachedDescription'); ?></i><br><br></div>
  46. <div class="tagtd valign-middle text-align-left">
  47. <div class="float-left">
  48. <?php
  49. if (class_exists("Memcached") || class_exists("Memcache")) {
  50. if (class_exists("Memcached")) {
  51. $m=new Memcached();
  52. } elseif (class_exists("Memcache")) {
  53. $m=new Memcache();
  54. }
  55. $serveraddress = (!empty($conf->global->MULTICOMPANY_MEMCACHED_SERVER)?$conf->global->MULTICOMPANY_MEMCACHED_SERVER:(!empty($conf->global->MEMCACHED_SERVER)?$conf->global->MEMCACHED_SERVER:'127.0.0.1:11211'));
  56. $tmparray=explode(':',$serveraddress);
  57. $server=$tmparray[0];
  58. $port=$tmparray[1]?$tmparray[1]:11211;
  59. $result=$m->addServer($server, $port);
  60. $arraycache=$m->getStats();
  61. if (is_array($arraycache)) {
  62. echo $form->textwithtooltip('',$langs->trans("MemcachedServerIsReady"),2,1,img_picto('','tick'),'',3);
  63. } else {
  64. echo $form->textwithtooltip('',$langs->trans("MemcachedServerIsNotReady"),2,1,img_warning(''),'',3);
  65. }
  66. echo ' <input size="40" type="text" id="MULTICOMPANY_MEMCACHED_SERVER" name="MULTICOMPANY_MEMCACHED_SERVER" value="'.$serveraddress.'"'.(empty($conf->global->MULTICOMPANY_MEMCACHED_ENABLED) ? ' disabled="disabled"' : '').' />';
  67. } else {
  68. echo img_warning($langs->trans("MulticompanyMemcachedUnavailable")).' '.$langs->trans("MulticompanyMemcachedUnavailable");
  69. }
  70. ?>
  71. </div>
  72. </div>
  73. <div class="tagtd valign-middle button-align-right">
  74. <?php
  75. if (class_exists("Memcached") || class_exists("Memcache")) {
  76. $input = array(
  77. 'del' => array('MULTICOMPANY_SHMOP_ENABLED','MULTICOMPANY_SESSION_ENABLED'),
  78. 'disabledenabled' => array('MULTICOMPANY_MEMCACHED_SERVER')
  79. );
  80. echo ajax_mcconstantonoff('MULTICOMPANY_MEMCACHED_ENABLED', $input, 0);
  81. } else {
  82. echo '<span>'.img_picto($langs->trans("Disabled"),'switch_off', 'class="button-not-allowed"').'</span>';
  83. }
  84. ?>
  85. </div>
  86. </div>
  87. </div>
  88. <div class="table-border centpercent">
  89. <div class="table-border-row oddeven">
  90. <div class="tagtd padding-left5 seventy-percent" align="left"><b><?php echo $langs->trans("MulticompanyShmop"); ?></b><br><i><?php echo $langs->trans('MulticompanyShmopDescription'); ?></i><br><br></div>
  91. <div class="tagtd valign-middle text-align-left">
  92. <div class="float-left">
  93. <?php
  94. if (function_exists("shmop_read")) {
  95. echo img_picto($langs->trans("MulticompanyShmopAvailable"),'tick').' '.$langs->trans("MulticompanyShmopAvailable");
  96. } else {
  97. echo img_warning($langs->trans("MulticompanyShmopUnavailable")).' '.$langs->trans("MulticompanyShmopUnavailable");
  98. }
  99. ?>
  100. </div>
  101. </div>
  102. <div class="tagtd valign-middle button-align-right">
  103. <?php
  104. if (function_exists("shmop_read")) {
  105. $input = array(
  106. 'del' => array('MULTICOMPANY_MEMCACHED_ENABLED','MULTICOMPANY_SESSION_ENABLED'),
  107. 'disabled' => array('MULTICOMPANY_MEMCACHED_SERVER')
  108. );
  109. echo ajax_mcconstantonoff('MULTICOMPANY_SHMOP_ENABLED', $input, 0);
  110. }
  111. else
  112. echo '<span>'.img_picto($langs->trans("Disabled"),'switch_off', 'class="button-not-allowed"').'</span>';
  113. ?>
  114. </div>
  115. </div>
  116. </div>
  117. <!-- END PHP TEMPLATE ADMIN CACHES -->